CoCreate User Forum  

Go Back   CoCreate User Forum > Support > Customization

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old 10-05-2005, 01:38 AM
brm brm is offline
Registered User
 
Join Date: Dec 2002
Posts: 66
Question Point Angle

See The Enclosed Fig_1.
How Can Do To Define The P4 Point With A Macro.
Attached Files
File Type: txt FIG_1.txt (8.4 KB, 509 views)
Reply With Quote
  #2  
Old 10-05-2005, 04:55 AM
Thom Ivancso's Avatar
Thom Ivancso Thom Ivancso is offline
Registered User
 
Join Date: Oct 2002
Location: Connecticut, USA
Posts: 212
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
Reply With Quote
  #3  
Old 10-05-2005, 05:22 AM
brm brm is offline
Registered User
 
Join Date: Dec 2002
Posts: 66
Re: Point Angle

New Picture.
Reply With Quote
  #4  
Old 10-05-2005, 05:24 AM
brm brm is offline
Registered User
 
Join Date: Dec 2002
Posts: 66
Re: Point Angle

New Pictures.
Attached Files
File Type: zip FIG_1.zip (4.6 KB, 461 views)
Reply With Quote
  #5  
Old 10-05-2005, 06:10 AM
Thom Ivancso's Avatar
Thom Ivancso Thom Ivancso is offline
Registered User
 
Join Date: Oct 2002
Location: Connecticut, USA
Posts: 212
Re: Point Angle

brm,

How is your macro generating points P1 through P3?

Cheers,
Thom
Reply With Quote
  #6  
Old 10-05-2005, 09:56 PM
brm brm is offline
Registered User
 
Join Date: Dec 2002
Posts: 66
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
Reply With Quote
  #7  
Old 10-06-2005, 10:52 AM
John Scheffel's Avatar
John Scheffel John Scheffel is offline
Administrator
 
Join Date: Sep 2002
Location: San Jose, CA
Posts: 1,288
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
Reply With Quote
  #8  
Old 10-06-2005, 09:54 PM
brm brm is offline
Registered User
 
Join Date: Dec 2002
Posts: 66
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?
Reply With Quote
  #9  
Old 10-07-2005, 02:08 PM
John Scheffel's Avatar
John Scheffel John Scheffel is offline
Administrator
 
Join Date: Sep 2002
Location: San Jose, CA
Posts: 1,288
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
Reply With Quote
  #10  
Old 10-09-2005, 10:06 PM
brm brm is offline
Registered User
 
Join Date: Dec 2002
Posts: 66
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?
Reply With Quote
  #11  
Old 10-10-2005, 04:25 PM
John Scheffel's Avatar
John Scheffel John Scheffel is offline
Administrator
 
Join Date: Sep 2002
Location: San Jose, CA
Posts: 1,288
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
Reply With Quote
  #12  
Old 10-10-2005, 10:40 PM
brm brm is offline
Registered User
 
Join Date: Dec 2002
Posts: 66
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
Reply With Quote
  #13  
Old 10-11-2005, 09:47 AM
John Scheffel's Avatar
John Scheffel John Scheffel is offline
Administrator
 
Join Date: Sep 2002
Location: San Jose, CA
Posts: 1,288
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
Reply With Quote
  #14  
Old 10-11-2005, 02:13 PM
Thom Ivancso's Avatar
Thom Ivancso Thom Ivancso is offline
Registered User
 
Join Date: Oct 2002
Location: Connecticut, USA
Posts: 212
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
Reply With Quote
  #15  
Old 10-11-2005, 10:28 PM
brm brm is offline
Registered User
 
Join Date: Dec 2002
Posts: 66
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.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 09:01 PM.



Hosted by SureServer    Forums   Modeling FAQ   Macro Site   Vendor/Contractors   Software Resellers   CoCreate   Gallery   Home   Board Members   Regional User Groups  By-Laws  

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.