CoCreate User Forum  

Go Back   CoCreate User Forum > Support > Customization

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
  #16  
Old 10-14-2005, 04:10 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

OK, I think I finally understand exactly what you want the macro to do. Try this one.

Code:
DEFINE Stretch_line

LOCAL Pick_pnt1
LOCAL Pick_pnt2
LOCAL Pick_type
LOCAL Epnt_1
LOCAL Epnt_2
LOCAL Line_angle
LOCAL Line_length
LOCAL Seg_1
LOCAL Seg_2
LOCAL Keep_pnt
LOCAL Pick_dist
LOCAL Theta
LOCAL Trim_dist
LOCAL Trim_pnt

LOOP
  LOOP
	READ PNT 'Indicate line, near end to extend.' Pick_pnt1
	INQ_ELEM Pick_pnt1
	LET Pick_type (INQ 403)
	EXIT_IF (Pick_type=LINE)
  END_LOOP

  LET Epnt_1 (INQ 101)
  LET Epnt_2 (INQ 102)
  MEASURE_DISTANCE Epnt_1 Epnt_2
  LET Line_length (INQ 3)
  MEASURE_DISTANCE Pick_pnt1 Epnt_1
  LET Seg_1 (INQ 3)
  MEASURE_DISTANCE Pick_pnt1 Epnt_2
  LET Seg_2 (INQ 3)

  IF (Seg_1 > Seg_2)
	LET Keep_pnt Epnt_1
	LET Line_angle (ANG(Epnt_2-Epnt_1))
  ELSE
	LET Keep_pnt Epnt_2
	LET Line_angle (ANG(Epnt_1-Epnt_2))
  END_IF

  LOOP
	READ PNT 'Indicate next point.' RUBBER_LINE_ANG Keep_pnt Line_angle Pick_pnt2
	EXIT_IF (Pick_pnt2<>Keep_pnt)
  END_LOOP

  MEASURE_DISTANCE Keep_pnt Pick_pnt2
  LET Pick_dist (INQ 3)
  LET Pick_angle (ANG(Pick_pnt2-Keep_pnt))
  LET Theta (Pick_angle - Line_angle)
  LET Trim_dist (Pick_dist*(COS Theta))
  LET Trim_pnt (Keep_pnt + (PNT_XY (Trim_dist*(COS Line_angle)) (Trim_dist*(SIN Line_angle))))

  MODIFY Pick_pnt1 SCALE CENTER Keep_pnt (Trim_dist/Line_length) 
END_LOOP

END_DEFINE
__________________
John Scheffel
Reply With Quote
  #17  
Old 10-21-2005, 12:08 AM
brm brm is offline
Registered User
 
Join Date: Dec 2002
Posts: 66
Re: Point Angle

Thank You It's Work Correctly.
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 01:16 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.