Polar acting wierd

Polar acting wierd

Anonymous
Not applicable
697 Views
7 Replies
Message 1 of 8

Polar acting wierd

Anonymous
Not applicable

Ok, I'm not sure what is going on here but in my program using polar anything over 45 deg polar starts to go backwards.  For example if 60 deg is entered it gives me and angle at 30 deg.  Yet in a test I made in the same program it works fine. 

 

Here is the section of my program that im talking about:

 

(setq pltinrad (+ tankdiam 8))
(setq pltoutrad (+ tankdiam (+ 8 (nth rn RSPDEPTH))))
(setvar 'clayer "Radial Trim1")
(command "CIRCLE" TANKCTR pltinrad)
(setvar 'clayer "Radial Trim2")
(command "CIRCLE" TANKCTR pltoutrad)
(setq lninpt1 (list TANKTOCXXL (+ TANKTOCYL pltinrad)))
(setq lnoutpt1 (list TANKTOCXXL (+ TANKTOCYL pltoutrad)))
(setvar 'clayer "Radial Trim3")
(command "line" lninpt1 lnoutpt1 "")
(setq endang (- (nth rn RSPEORIENT) (nth rn RSPSORIENT)))

;; TEST
(setq ang 0)
(repeat 9
(setq endangp (* PI (/ ang 180.0)))
(setq lninpt2 (polar TANKCTR endangp pltinrad))
(setq lnoutpt2 (polar TANKCTR endangp pltoutrad))
(prompt "\n ang: ")
(princ ang)
(prompt "\n")
(prompt "\n endangp: ")
(princ endangp)
(prompt "\n")
(setvar 'clayer "Pipe2")
(command "line" lninpt2 lnoutpt2 "")
(setq ang (+ ang 10))
)
;; End TEST

(setq endangp (* PI (/ endang 180.0)))
(setq lninpt2 (polar TANKCTR endangp pltinrad))
(setq lnoutpt2 (polar TANKCTR endangp pltoutrad))
(setq mirang (/ endang 2))
(setq mirangp (+ (/ (* mirang PI) 180) (/ PI 4)))
(setq mirlnpt (polar TANKCTR mirangp pltoutrad))
(setvar 'clayer "Radial Trim4")
(command "line" lninpt2 lnoutpt2 "")
(prompt "\n endang: ")
(princ endang)
(prompt "\n")
(prompt "\n endangp: ")
(princ endangp)
(prompt "\n")

 

at 60 deg. the output is drawing4 and :

ang: 60
endangp: 1.0472

endang: 60.0
endangp: 1.0472

 

at 45 deg. the output is drawing4-2 and :

ang: 40
endangp: 0.698132
ang: 50
endangp: 0.872665
endang: 45.0
endangp: 0.785398

 

Can anyone explane what is going on?

 

 

0 Likes
Accepted solutions (1)
698 Views
7 Replies
Replies (7)
Message 2 of 8

stevor
Collaborator
Collaborator
Maybe relevant: turn off the object snap: (setvar 'osmode 0) if not others also.
S
0 Likes
Message 3 of 8

Anonymous
Not applicable

Thank you for replying but I have it turned off at the begining of the program as well as projmode set to 0.

 

(command "PROJMODE" 0)
(command "OSNAP" "OFF")

0 Likes
Message 4 of 8

Kent1Cooper
Consultant
Consultant

When you say "when 60 degrees is entered," what does that mean?  I don't see anything asking the User to enter an angle.  Is that the 'endang' variable coming from just above the TEST part?  If so, you don't include anything about the lists from which it's calculating that value -- could there be something wrong with those?  And what is 'mirang' for?  It doesn't seem to be used for anything -- does that matter?  Your description of drawing4 shows that for 60 degrees, 60 appears to be returned, not 30 as indicated at the top of the Post.  Can you post something like side-by-side images of what you want compared to what you're getting instead, pointing to what's wrong in the latter?

Kent Cooper, AIA
0 Likes
Message 5 of 8

Anonymous
Not applicable

The inputs are coming from an excel document.  For now I’m entering 0 for the first angle and 45, 60 ect for the second angle.  They will be changing depending on the size that the user wants.  This is just one small portion of a much larger program.  The ’mirang’  is supposed to be the mid point of the other 2 angles, the added (/ PI 4) I put to make it work for the 45 degrees I was working with at the start don’t know why lol.  I can fix it when I figure out what is wrong.  Since you asked me all this I tried a few more angles and I find the only one that works is the 45 degrees. I really don’t know what is going on with this.  If I try 40 it puts the line at 50.  I’ll try posting a few more images with the test taken out so you can see the results better.

Test1 40 degrees

Test2 45 degrees

Test3 50 degrees

To give you a bigger picture of what I’m doing I’ll post an image of what this section of the program makes, with 45 degrees entered anyway lol.  I was close to finishing it when I decided to change the size to check the placement of some of the items.

0 Likes
Message 6 of 8

Anonymous
Not applicable

It will only let be post 3 attachments so here is the finished one at 45 degrees.

0 Likes
Message 7 of 8

Kent1Cooper
Consultant
Consultant
Accepted solution

The (polar) function uses its 'ang' argument [to quote Help about it] "...in radians relative to the world X axis. Angles increase in the counterclockwise direction, independent of the current construction plane."  You appear to be going for angles measured clockwise, and from 0 as being upward, but in (polar)'s terms, that's 90 degrees.  Try:

...

(setq endangp (* PI (/ (- 90.0 endang) 180.0))); endang in WCS radians

...

Kent Cooper, AIA
Message 8 of 8

Anonymous
Not applicable

Thank you so much.  I  cann't believe I forgot that lol.

0 Likes