Hi Everyone,
Hoping someone here can help me out.
I am trying to write a lisp routine to preform, what I used to believe is a simple task, but its proving to be challenging.
That basic run down is like this.
User picks a point, then the corresponding text or Mtext associated with it.
User picks second point, then the corresponding text or Mtext associated with it.
The Lisp draws a temp line between the 2 points, gets the mid point.
Afterwards I want to be able to pick a direction perpendicular to the temp line to set the angle and side to which I am going to draw a polyline.
This is the part I am having trouble with.
The idea is that no matter which way I select the points, the user will always be in control of what side to draw the polyline on.
I have attached an image of what the end result I am trying to achieve.
The 2 selectable points would be the X and the 192.13 (bottom left) and X and the 192.19 (Bottom right)
Then the User would have something to select a direction perpendicular to the line created between those 2 points. The user would select the direction that the 3% arrow is pointing.
Then the Lisp would draw the cyan coloured polyline with the arcs in it. Arcs are always a 5m radius where the straight line portion is variable based on the length between the 2 points minus 10m.
The first part of my code looks like this. I just dont know where to take it from there. The last part where it does all the calcs is mostly worked out..
Also pardon my poor LISP coding. I mostly learn by cobbling things together and reading Lee Macs amazing lisps which 75% of them I dont understand.
(DEFUN C:RAPRN (/ *error* PT1 PT2 PT3 ELV1 ELV2 )
(vl-load-com)
(setq blkname "BIGUMS")
(setq acadobj (vlax-get-acad-object)
adoc (vla-get-ActiveDocument acadobj)
msp (vla-get-ModelSpace adoc)
activeundo nil)
(setq swllayer "SWALE")
(setq tmplayer "Defpoints")
(setq cl (getvar 'clayer))
(setvar 'clayer swllayer)
;; --------------------------- START ROUTINE --------------------------- ;;
(if
(and
(if (= 4 (logand 4 (cdr (assoc 70 (tblsearch "layer" (getvar 'clayer))))))
(alert "\nPlease unlock the current layer before proceeding!")
T
)
(setq pt1 (getpoint "\nSelect high grade point: "))
(and
(setq elv1 (car (entsel "\nSelect high grade elevation text: ")))
(if (null (wcmatch (cdr (assoc 0 (entget elv1))) "TEXT,MTEXT"))
(null (princ "\nObject is not a text"))
T)
)
(setq pt2 (getpoint "\nSelect low grade point: "))
(and
(setq elv2 (car (entsel "\nSelect low grade elevation text: ")))
(if (null (wcmatch (cdr (assoc 0 (entget elv2))) "TEXT,MTEXT"))
(null (princ "\nObject is not a text"))
T)
(setq tmpln
(entmakex
(list
'(0 . "LINE")
(cons 10 pt1)
(cons 11 pt2)
)
)