#1
|
|||
|
|||
Point Angle
See The Enclosed Fig_1.
How Can Do To Define The P4 Point With A Macro. |
#2
|
||||
|
||||
Re: Point Angle
Hello brm,
Your image did not get attached correctly it seems, could you attach a new one to the post? I also moved your last two posts to the Customizataion thread, since they are not a Drafting usage question. Cheers, Thom |
#3
|
|||
|
|||
Re: Point Angle
New Picture.
|
#4
|
|||
|
|||
Re: Point Angle
New Pictures.
|
#5
|
||||
|
||||
Re: Point Angle
brm,
How is your macro generating points P1 through P3? Cheers, Thom |
#6
|
|||
|
|||
Re: Point Angle
It's the same to extend line applied to oblique line.
The point to find is P5. DEFINE st_line LOCAL P1 LOCAL E1 LOCAL P2 LOCAL P3 LOCAL ang_linea LOCAL D1_2 LOCAL D1_3 LOCAL P4 LOCAL P5 LOOP LOOP READ PNT 'Indicate line, near end to extend.' P1 INQ_ELEM P1 LET E1 (INQ 403) EXIT_IF (E1=LINE) END_LOOP IF (E1=LINE) LET P2 (INQ 101) LET P3 (INQ 102) LET ang_linea (ANG(P2-P3)) MEASURE_DISTANCE P1 P2 LET D1_2 (INQ 3) MEASURE_DISTANCE P1 P3 LET D1_3 (INQ 3) END_IF IF (D1_2<D1_3) LOOP READ PNT 'Indicate next point.' RUBBER_LINE_ANG P2 (ang_linea) P4 EXIT_IF ((P4<>P1)AND(P4<>P2)AND(P4<>P3)) END_LOOP ELSE_IF (D1_2>D1_3) LOOP READ PNT 'Indicate next point.' RUBBER_LINE_ANG P3 (ang_linea) P4 EXIT_IF ((P4<>P1)AND(P4<>P3)AND(P4<>P2)) END_LOOP END_IF used for horizontal line IF ((D1_2>D1_3)AND(((Y_OF P2)=(Y_OF P3))AND((X_OF P4)>(X_OF P3)))) LET P5 (PNT_XY (X_OF P4) (Y_OF P3)) MODIFY SCALE CENTER P2 P3 P5 P1 END ELSE_IF ((D1_2>D1_3)AND(((Y_OF P2)=(Y_OF P3))AND((X_OF P4)<(X_OF P3)))) LET P5 (PNT_XY (X_OF P4) (Y_OF P3)) MODIFY SCALE CENTER P2 P3 P5 P1 END END_IF END_LOOP END_DEFINE |
#7
|
||||
|
||||
Re: Point Angle
I'm don't understand how your macro points (P1, P2...) relate to the points in your bitmap image.
In the image, both ends of the line are labled as P1. There is a point P4 on the line and a point P3 90 degrees of the line at some unspecified distance. In your macro, the user is prompted to pick P1 which is a point on the line. The endpoints of the selected line are set to P2 and P3. The user is then prompted to pick P4 which is different than P1, P2 or P3 but on the line. Can you provide a description of what you want this macro to do? It still isn't clear to me.
__________________
John Scheffel |
#8
|
|||
|
|||
Re: Point Angle
Sorry but this macro should used to extend a line.
The picture is an example. First select the line P1 then define the point to extend P4. If the line is not horizontal or vertical i have difficult to applied this macro with scale command. The point P4 is used to define the point P5 that is the projection of P4 on the line. Is possible calculate it? |
#9
|
||||
|
||||
Re: Point Angle
I'm still not sure I completely understand what you are trying to do. When you say "extend" a line, do you mean create a line? From your original bitmap it appears you want to create a new line perpendicular to the line selected by P1 and intersecting at selected point P4. If this is the case, have you considered using the LINE command? Something like the following might work.
LINE PERPENDICULAR P1 P4 Does this do what you want?
__________________
John Scheffel |
#10
|
|||
|
|||
Re: Point Angle
This command should be a strech line command without deleting the original line but extended by scale command.
The perpendicular line P3-P4 in the picture is an imaginary line. By the point P3 is possible calculate the point P4 and strech the line up to P4? |
#11
|
||||
|
||||
Re: Point Angle
Try this. It doesn't do exactly what you want. It deletes the original line and creates a new line instead of extending the existing line. But I think the end result is what you want.
Code:
DEFINE st_line LOCAL P1 LOCAL E1 LOCAL P2 LOCAL P3 LOCAL ang_linea LOCAL D1_2 LOCAL D1_3 LOCAL P4 LOCAL P5 LOOP LOOP READ PNT 'Indicate line, near end to extend.' P1 INQ_ELEM P1 LET E1 (INQ 403) EXIT_IF (E1=LINE) END_LOOP IF (E1=LINE) LET P2 (INQ 101) LET P3 (INQ 102) LET ang_linea (ANG(P2-P3)) MEASURE_DISTANCE P1 P2 LET D1_2 (INQ 3) MEASURE_DISTANCE P1 P3 LET D1_3 (INQ 3) END_IF IF (D1_2<D1_3) LOOP READ PNT 'Indicate next point.' RUBBER_LINE_ANG P2 (ang_linea) P4 EXIT_IF ((P4<>P1)AND(P4<>P2)AND(P4<>P3)) END_LOOP DELETE P1 LINE PT_ANG_DIST P3 ang_linea P4 END ELSE_IF (D1_2>D1_3) LOOP READ PNT 'Indicate next point.' RUBBER_LINE_ANG P3 (ang_linea) P4 EXIT_IF ((P4<>P1)AND(P4<>P3)AND(P4<>P2)) END_LOOP DELETE P1 LINE PT_ANG_DIST P2 ang_linea P4 END END_IF END_LOOP END_DEFINE
__________________
John Scheffel |
#12
|
|||
|
|||
Re: Point Angle
THANK YOU, it is A VALID SOLUTION, ALSO If SHOULD BETTER don't CANCEL THE LINE.
HOW COME THIS MACRO doesn't ALWAYS WORK. IT WORK TWO Or THREE TIMES IN THE SAME LINE THEN doesn't MODIFY. FOR HORIZONTAL LINES. DEFINE st_line LOCAL P1 LOCAL E1 LOCAL P2 LOCAL P3 LOCAL ang_linea LOCAL D1_2 LOCAL D1_3 LOCAL P4 LOCAL P5 LOOP LOOP READ PNT 'Indicate line, near end to extend.' P1 INQ_ELEM P1 LET E1 (INQ 403) EXIT_IF (E1=LINE) END_LOOP IF (E1=LINE) LET P2 (INQ 101) LET P3 (INQ 102) LET ang_linea (ANG(P2-P3)) MEASURE_DISTANCE P1 P2 LET D1_2 (INQ 3) MEASURE_DISTANCE P1 P3 LET D1_3 (INQ 3) END_IF IF (D1_2<D1_3) LOOP READ PNT 'Indicate next point.' RUBBER_LINE_ANG P2 (ang_linea) P4 EXIT_IF ((P4<>P1)AND(P4<>P2)AND(P4<>P3)) END_LOOP ELSE_IF (D1_2>D1_3) LOOP READ PNT 'Indicate next point.' RUBBER_LINE_ANG P3 (ang_linea) P4 EXIT_IF ((P4<>P1)AND(P4<>P3)AND(P4<>P2)) END_LOOP END_IF IF ((D1_2>D1_3)AND(((Y_OF P2)=(Y_OF P3))AND((X_OF P4)>(X_OF P3)))) LET P5 (PNT_XY (X_OF P4) (Y_OF P3)) MODIFY SCALE CENTER P2 P3 P5 P1 END ELSE_IF ((D1_2>D1_3)AND(((Y_OF P2)=(Y_OF P3))AND((X_OF P4)<(X_OF P3)))) LET P5 (PNT_XY (X_OF P4) (Y_OF P3)) MODIFY SCALE CENTER P2 P3 P5 P1 END END_IF DELETE SELECT POINTS ALL CONFIRM END WHITE END_LOOP END_DEFINE |
#13
|
||||
|
||||
Re: Point Angle
I tried your macro, and you are correct that after a few times it stops working. As far as I can tell it never works if I pick the left side of a horizontal line. If I pick the right side it works for a few tries then stops working.
I'm not sure exactly why, but I ran a TRACE and the logic around the MODIFY SCALE commands was returning zero for both the IF and ELSE_IF tests. So neither of the MODIFY commands being run so the line is not modified. I'm not sure I understand what this logic is trying to determine and don't have more time to spend on it. If you really want to debug it, try using the TRACE command to see what your macro is doing. Just enter something like the following on the Drafting command line: TRACE DEL_OLD 'C:\temp_trace.txt' Then run your macro. When it starts failing enter TRACE OFF on the command line. Then open the above file in a text editor and try to determine why the logic is returning zero for both tests.
__________________
John Scheffel |
#14
|
||||
|
||||
Re: Point Angle
Hello brm,
I guess one question I would like to ask is what is the use model for this macro, what is the user trying to accomplish with it? It might give us a better understanding on how it is suppose to work. Cheers, Thom |
#15
|
|||
|
|||
Re: Point Angle
THIS MACRO should ALLOW to MODIFY FREELY The LENGTH Of A LINE.
THE MACRO STRECH_LINE DOWNLOADED, CANCEL THE EXISTING LINE it Is Not CORRECT , BECAUSE If there ARE DIMENSIONS CONNECTED TO THIS LINE will COME DELETED. |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | Search this Thread |
Display Modes | Rate This Thread |
|
|