Jump to content

? create new UCS at an angle in AutoLISP ?


positive_X

Recommended Posts

Hello ,

I am learning AutoLISP ;

and have 20 + custom coordinate systems ( UCS ) at an angle

& would like to learn AutoLISP to automate these .

Using UCS 3point that seems to ignore (& stop) at the second point :

;; TESTing 20160911
;  Create UCS 'tipped' towards Point "ReflNN_1" 
   
   (setq point1 '(0 0 0) point2 '((/ (sqrt(+ (expt 20.8125 2.0) (expt 20.8125 2.0))) 2.0) (- 63.0 0.625) 0) point3 '(0 0 1)) ;;  from UCS 'horizonatally' to the 
   
   (command "_.ucs" "_3p" point1 point2 point3) ;; UCS Origin , Positive X Axis , Positive Y Orientation _ the Refel , Tip the UCS towards THE  Point ,  UCS Positive Z direction unit 
   (command "_.ucs" "_na" "_s" "Refl25_1_TEST")

;; end_TESTing 20160911

Edited by positive_X
Link to comment
Share on other sites

Claculating the numbers manually for setq works :

;; TESTing 20160911
;  Create UCS 'tipped' towards Point "ReflNN_1"  active in Array_Reflector25_1
; foc_z @ 63.0
; (20.8125 20.8125 0.625)
   
   (setq point1 '(0 0 0) point2 '(-14.716659883445020351592573286307 62.375 0) point3 '(0 0 1)) ;;  from UCS 'horizonatally' to the 
   
   (command "_.ucs" "_3p" point1 point2 point3) ;; UCS Origin , Positive X Axis , Positive Y Orientation _ the Refel , Tip the UCS towards THE  Point ,  UCS Positive Z direction unit 
   (command "_.ucs" "_na" "_s" "Refl25_1_TEST")

;; end_TESTing 20160911

however , I would like to calculate in the setq , in order to further automate it .

Link to comment
Share on other sites

Interesting. I couldn't get point2 to be properly created either when I used the quote (') instead of list, but if I went ahead and used list I got it to work:

 

(setq point1 '(0 0 0) point2 (list (/ (sqrt (+ (expt 20.8125 2.0) (expt 20.8125 2.0))) 2.0) (- 63.0 0.625) 0) point3 '(0 0 1))

I hope someone will come along and explain why...

 

BKT

Link to comment
Share on other sites

Just got back from Lee Mac's amazing site, and the explanation for use of the apostrophe and the quote function is described in depth.

 

http://www.lee-mac.com/quote.html

 

Thanks again, Lee Mac!

You're welcome - glad it was clear!

Thank you both very much .

.

My trig was incorrect ;

I need to halve the angle not a horiz. dist . (I still need the horiz dist though) .

..

Now I need to learn more about how to handle angles in AutoLISP .

And how to handle arrays of data in AutoLISP .

...

My task is to create MANY User Coordinate Systems ( UCS ) es at 'double' angles :

The FIRST is rotated in the World Coordinate System ( WCS ) , origin at a known point WCS (x1 y1 z1) (MANY of these) & with the X axis 'heading' towards the WCS origin (0 0 0) , my AutoLISP works for that ;

then while active in this (these many ucs es) ,

the SECOND UCS Z axis is 'tipped' [ 1 / 2 ] of the way 'rotated' towards a (single) know point WCS (x_important y_important z_important) .

{I did this manually by drawing an arc then a line to the mid_of , in order to define the 'second' ucs .}

...

And I am just learning AutoLISP ...

Edited by positive_X
Link to comment
Share on other sites

Interesting did a quick copy and paste to see what was happening.

 

Command: (setq point2 '((/ (sqrt(+ (expt 20.8125 2.0) (expt 20.8125 2.0))) 2.0) (- 63.0 0.625) 0))

((/ (SQRT (+ (EXPT 20.8125 2.0) (EXPT 20.8125 2.0))) 2.0) (- 63.0 0.625) 0)

 

Command: !point2

((/ (SQRT (+ (EXPT 20.8125 2.0) (EXPT 20.8125 2.0))) 2.0) (- 63.0 0.625) 0)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...