CoCreate User Forum  

Go Back   CoCreate User Forum > Support > Customization

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old 11-19-2016, 06:23 AM
kting kting is offline
Registered User
 
Join Date: Nov 2008
Posts: 17
Question Some questions in the code

I programed a add-on application to rotate the part with a specified angle value.Follow attachment is the code file:test.lsp

In the program the part should be rotate 0.9 degree.Actually,the result is that the part is rotated 51.566202degree.
Click image for larger version

Name:	eg1.jpg
Views:	65
Size:	14.1 KB
ID:	1939Click image for larger version

Name:	eg2.jpg
Views:	70
Size:	13.0 KB
ID:	1940Click image for larger version

Name:	drafting.jpg
Views:	69
Size:	18.0 KB
ID:	1942

However,when I change the code ":push-action (sd-call-cmds (g_test))" to ":push-action (g_test)",the result is that the part is rotated 0.9degree.

I can't understand why produce different results by using function sd-call-cmds and no using it in the program.

Could anybody explain it for me?

How to change the program code to keep the dialog when doing a terminate action and rotate the part a specified angle value in the program?
__________________
Best regards,
Kting

Last edited by kting; 11-23-2016 at 11:17 PM.
Reply With Quote
  #2  
Old 11-22-2016, 03:16 AM
rvn rvn is offline
Registered User
 
Join Date: Mar 2011
Posts: 46
Re: Some questions in the code

Hi Kting,

You need to use radials instead of degrees.
Convert your degrees with (sd-deg-to-rad "angle in degrees") to radials and use this.
Normally this should work.

gr
Ruben
Reply With Quote
  #3  
Old 11-23-2016, 11:31 PM
kting kting is offline
Registered User
 
Join Date: Nov 2008
Posts: 17
Re: Some questions in the code

Hi Ruben,

I still did not understand that.
Why should modeling position_pa action take a degree input without using sd-call-cmds and take a radians input using sd-call-cmds in the program?
__________________
Best regards,
Kting
Reply With Quote
  #4  
Old 11-24-2016, 06:45 AM
rvn rvn is offline
Registered User
 
Join Date: Mar 2011
Posts: 46
Re: Some questions in the code

Hi Kting

In the normal dialog you give the angle in degrees but in the back (in the code) the angle is converted to radials.
So if you make use of the code with lisp then you should use radials instead of degrees.
Or you need to convert it yourself in the back.

You give in 0.9degree and get 51....degrees. Just to point out what happens here --> 0.9rad = 51,... deg :-).

The only thing you need to put in the code is this:
Code:
(position_pa :part_assembly test_p
                     :rotate :axis :pt_dir fix_pnt1 (first dir1)
                     :rotation_angle (sd-deg-ro-rad 0.9)
                     :done)
And normally this should work perfectly.

kind regards
Ruben
Reply With Quote
  #5  
Old 11-25-2016, 06:07 PM
kting kting is offline
Registered User
 
Join Date: Nov 2008
Posts: 17
Re: Some questions in the code

You are right. Thank you very much.
__________________
Best regards,
Kting
Reply With Quote
  #6  
Old 11-27-2016, 04:49 AM
rvn rvn is offline
Registered User
 
Join Date: Mar 2011
Posts: 46
Re: Some questions in the code

Quote:
Originally Posted by kting View Post
You are right. Thank you very much.
No problem at all. Glad I could help.
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 05:34 AM.



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 - 2020, Jelsoft Enterprises Ltd.