I'm just starting to pick up autolisps and have been playing around qith creating one that will measure the distance between two points and then insert the value in mtext as at a selected location.
Any help would be great,
Thanks
|
I'm just starting to pick up autolisps and have been playing around qith creating one that will measure the distance between two points and then insert the value in mtext as at a selected location.
Any help would be great,
Thanks
Hi,
Try this.
Code:(defun c:Test ( / p1 p2 p3) (and (setq p1 (getpoint "\nSpecify first point :")) (setq p2 (getpoint "\nNext point :" p1)) (setq p3 (getpoint "\nSpecify text location :")) (entmakex (list '(0 . "MTEXT") '(100 . "AcDbEntity") '(100 . "AcDbMText") (cons 10 p3) (cons 1 (rtos (distance p1 p2) 2)))) ) (princ) )
Thanks heaps,
If I wanted to incorporate a naming function for the distances and an option for text rotation how would I go about that?
You are welcome.
Sorry I didn't get your point.
Just add the DXF codes as the following and the angle value supposed to be in radians.
Important link for Mtext dxf codes: HERECode:(cons 50 (* pi 0.5)) ;; eg: 90 Degree
"incorporate a naming function for the distances"
Sorry. I meant if I wanted to include the prefix "dtm" prior to the difference in distance. I'm not sure if I'm making much sense. Haha.
Eg- "dtm 6.25"
I see now ...
Just add the following codes into the above posted codes like this.
Code:(cons 1 (strcat "dtm " (rtos (distance p1 p2) 2)))
If you want to auto the text angle use the angle of the two points it may draw upside down so you can also do a check for readability and use -90 instead. There will be some examples out there to check angle against current quadrant.