I dont know anything about LISPs but here is the routine we have
;;
(defun varset ()
(setq ap (getvar "attreq"))
(setq osin (getvar "OSMODE"))
(setvar "OSMODE" 0)
(if (= ap 0)
(progn
(setvar "ATTREQ" 1)
(setvar "ATTDIA" 0)
)
)
(setq lnme (getvar "clayer"))
(setq halfpi (/ PI 2))
(setq 3hlfpi (* halfpi 3))
)
;;
;;
(defun c:lsr1al()
(varset)
(setq pent (car (entsel "\nPick the LASER object: ")))
(print (setq begpt (getpoint "\nPick the beginning: ")))
(setq albl (strcase (getstring "\nDo you wish to label the alignment?(Y/N) - ")))
(print "\nSelect the laser offset lines.... ")
(setq ofset nil)
(setq ofset (ssget '((0 . "LINE"))))
(setq allst (entget pent))
(setq ptx (car (cdr (assoc 10 allst))))
(setq pty (cadr (cdr (assoc 10 allst))))
(setq xy1 (list ptx pty))
(setq ptx2 (car (cdr (assoc 11 allst))))
(setq pty2 (cadr (cdr (assoc 11 allst))))
(setq xy2 (list ptx2 pty2))
;
; CHECK BEGINNING
;
(setq begchk (distance begpt xy1))
(setq endchk (distance begpt xy2))
(cond
((< endchk begchk)(progn
(setq begxy xy2)
(setq endxy xy1)))
((> endchk begchk)(progn
(setq begxy xy1)
(setq endxy xy2)))
)
(setq alang (angle begxy endxy))
(sortr)
(setq tbl (strcase (getstring "\nDo you wish to create an offset table?(Y/N) - ")))
(if (or (= tbl "y")(= tbl "Y"))
(listr)
)
(princ)
)
;;
;;
(defun sortr ()
(setq ct2 0)
(setq ct3 (sslength ofset))
(setq outlst nil)
(setq frst 1)
(while (< ct2 ct3)
(setq flg 0)
(setq entnam (ssname ofset ct2))
(PRINT (setq pntlst (entget entnam)))
(setq ptx (car (cdr (assoc 10 pntlst))))
(setq pty (cadr (cdr (assoc 10 pntlst))))
(setq ptxy (list ptx pty))
(setq ptx2 (car (cdr (assoc 11 pntlst))))
(setq pty2 (cadr (cdr (assoc 11 pntlst))))
(setq ptxy2 (list ptx2 pty2))
(setq intang (angle begxy ptxy))
(if (equal alang intang 0.00005)
(progn
(setq dst (distance begxy ptxy))
(setq ofang (angle ptxy ptxy2))
(setq flg 1)
(setq prntof ptxy2)
)
)
(if (= flg 0)
(progn
(setq dst (distance begxy ptxy2))
(setq ofang (angle ptxy2 ptxy))
(setq prntof ptxy)
)
)
(setq len (* 12 (distance ptxy ptxy2)))
(setq dsts (rtos dst 2 1))
(setq lenarc (rtos len 4 2))
(if (<= alang halfpi)
(progn
(setq angdif (- ofang alang))
(if (> angdif PI)
(setq dir " RT")
(setq dir " LT")
)
)
)
(if (>= alang 3hlfpi)
(progn
(setq angdif (abs (- ofang alang)))
(if (< angdif PI)
(setq dir " RT")
(setq dir " LT")
)
)
)
(if (and (> alang halfpi)(< alang 3hlfpi))
(if (< ofang alang)
(setq dir " RT")
(setq dir " LT")
)
)
(setq outdst (strcat dsts "ft"))
(setq outof (strcat lenarc dir))
(if (or (= albl "y")(= albl "Y"))
(progn
(if (= dir " LT")
(setq ofang (+ ofang PI))
)
(setq dstpt (polar prntof ofang -12.0))
(setq ofpt (polar prntof ofang 12.0))
(setq ofangs (angtos ofang))
(command "TEXT" "J" "MR" dstpt ofangs outdst)
(command "TEXT" "J" "ML" ofpt ofangs outof)
)
)
(setq outlin (strcat outdst " " outof "\\P"))
(if (/= frst 1)
(setq outtab (strcat outtab outlin))
)
(if (= frst 1)
(progn
(setq frst 2)
(setq outtab outlin)
)
)
(setq ct2 (1+ ct2))
)
)
;;
;;
(defun listr()
(setq txtins (getpoint "\nPick the coordinate text insertion point: "))
(command "MTEXT" txtins "W" 0 outtab "")
)
;;
;;
it gives me that error when i pick the offset lines
attached is a picture of what im working with..if you have any further questions please let me know
Quickly looking at the code, not testing it, I can see that (ssget '((0 . "LINE")))) is missing the mode parameter e.g.
(ssget "_X" '((0 . "LINE"))))
@fenton.webb wrote:
Quickly looking at the code, not testing it, I can see that (ssget '((0 . "LINE")))) is missing the mode parameter e.g.(ssget "_X" '((0 . "LINE"))))
@Anonymous wrote:
I have no idea what that means....
It doesn't necessarily need the mode parameter. Without one, it's left to the User to select things, and it accepts only those that meet the filter criteria -- you can grab a whole Windowed or Crossing area, and also pick on individual objects, and use other object-selection options such as Remove, and when you hit Enter to complete the selection, it will "find" only the Lines among whatever was selected, and ignore everything else. With the "_X" in there, it will find all Lines in the entire drawing, which I don't think is what you want.
Danielle,
I'm a metric guy, this was the main reason I asked for a dwg.
I tested the code, without errors (I think this is the intended result)
Henrique