CAD Forum - Database of tips, tricks and utilities for AutoCAD, Inventor and other Autodesk products [www.cadforum.cz]
CZ | EN | DE
Login or
registration
  Visitors: 8624
RSS channel - CAD tips RSS tips
RSS discussions

Discussion Discussion forum

 

HelpCAD discussion

 
CAD Forum - Homepage CAD discussion forum - ask any CAD-related questions here, share your CAD knowledge on AutoCAD, Inventor, Revit and other Autodesk software with your peers from all over the world. To start a new topic, choose an appropriate forum.

Please abide by the rules of this forum.

How to post questions: register or login, go to the specific forum and click the NEW TOPIC button.
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Topic ClosedGetpolar function

 Post Reply Post Reply
Author
lucasugar View Drop Down
Newbie
Newbie


Joined: 22.Feb.2016
Location: Italy
Using: AutoCAD
Status: Offline
Points: 2
Direct Link To This Post Topic: Getpolar function
    Posted: 22.Feb.2016 at 20:36
Hello to everybody,
I'd like to create a lisp function which waits for the user to specify a point which lies on a straight line passing through a specified point and inclined of a specified angle. It's not difficult to code but the function must show a rubber-line which moves only along the specified angle.
I already coded such a function. Here it is:

(defun getpolar (pt ang msg / r)
  (vl-cmdf "_line" pt (strcat "<" (angtos ang (getvar "AUNITS"))))
  (prompt msg)
  (command pause)
  (command)
  (setq r (getvar "LASTPOINT"))
  (entdel (entlast))
  (polarp pt ang (* (distance r pt) (cos (- (angle pt r) ang))))
)

Try it like this:

(getpolar '(0 0 0) 30 "Specifiy end point: ")


But I want the function not to create a line entity and then delete it.

Is there a simpler way?

For example, if from command-line I enter:

(getpoint '(0 0 0) "Specifiy end point: ")

and then:

<45

a rubber-line which moves only along an angle of 45° appears.

But how do I put it in a lisp function?

Thanks to all.

Back to Top

Related CAD tips:


 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down



This page was generated in 0,430 seconds.