Jump to content

snapang sys variable


Insener07

Recommended Posts

Hey!

i found this lisp routine

(while (not (setq ent (entsel "\nChoose an object: "))));
(setq obj_curv (vlax-ename->vla-object (car ent)))
(cond
((member
(vlax-get-property obj_curv 'ObjectName)
'("AcDbPolyline" "AcDb2dPolyline" "AcDbLine"
"AcDbArc" "AcDbCircle" "AcDbEllipse"
"AcDbSpline" "AcDbRay" "AcDbXline"
)
)
(setq
pt_sel (vlax-curve-getClosestPointTo
obj_curv
(trans (cadr ent) 1 0)
)
[color=red]param (vlax-curve-getparamatpoint obj_curv pt_sel); how do understand this line[/color]
[color=red]deriv (vlax-curve-getfirstderiv obj_curv param);how do understand this line[/color]
[color=red])[/color]
[color=red](setvar "snapang"[/color]
[color=red](+ (atan (cadr deriv) (car deriv)) (/ pi 2))[/color]
[color=red])[/color]

As i understand it should change the angle of crosshair perpendicular to object chosen. I made some lines red and it seems this makes it happen. But I can't get how does it make it so?. What important does this param and deriv variables have?

Can somebody explain me!

Thanks

M

Link to comment
Share on other sites

Put the code in VLIDE (Visual LISP editor built into AutoCAD), highlight the function in question, click on the question mark button and help will appear.

 

eg.

 

vlkide.jpg

Link to comment
Share on other sites

Alan,

 

Quick question: do you know a way to lock the toolbars in the VLIDE? They get on my nerves...

 

PS> Don't know about you, but I prefer the Lucida Console (10pt, Regular) font when writing my code - seems 'cleaner' :)

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...