Jump to content

Recommended Posts

Posted
;; LILO
;; Loop In Loop Out Cable

(defun C:LILO (/ os block ins rot cable clyr lyr point line pt1 ang offset
                dist pt2 pt3)
 (command "ucs" "w")
 (setq os (getvar "osmode"))
 (setvar "osmode" 0)
 (setq block (entsel "\nSelect Lighting Column: "))
 (setq ins (cdr (assoc 10 (entget (car block)))))
 (setq rot (rtd (cdr (assoc 50 (entget (car block))))))
 (setq cable (entsel "\nSelect Cable Run: "))
 (setq clyr (getvar "clayer"))
 (setq lyr (cdr (assoc 8 (entget (car cable)))))
 (setq point (osnap (cadr cable) "near"))
 (command "_.line" ins "perp" point "")
 (setq line (ssget "L"))
 (setq pt1 (cdr (assoc 11 (entget (ssname line 0)))))
 (entdel (entlast))
 (setq ang (angle ins pt1))
 (setq offset (dtr 25))
 (setq dist (distance ins pt1))
 (command "_.zoom" "c" ins (* 5 dist))
 (setq pt2 (polar ins (- ang offset) dist))
 (command "_.line" ins pt2 "")
 (command "_.extend" cable "" pt2 "")
 (setq line (ssget "L"))
 (setq pt2 (cdr (assoc 11 (entget (ssname line 0)))))
 (entdel (entlast))
 (setq pt3 (polar ins (+ ang offset) dist))
 (command "_.line" ins pt3 "")
 (command "_.extend" cable "" pt3 "")
 (setq line (ssget "L"))
 (setq pt3 (cdr (assoc 11 (entget (ssname line 0)))))
 (entdel (entlast))
 (setvar "clayer" lyr)
 (command "_.pline" pt2 ins pt3 "")
 (setvar "clayer" clyr)
 (command "_.extend" cable "" pt2 pt3 "")
 (command "_.break" cable "F" pt2 pt3)
 (entupd (car block))
 (setvar "osmode" os)
 (command "_.zoom" "p")
 (command "ucs" "p")
 (princ)
)

;; RTD
;; Converts Radians to Degrees

(defun rtd (a)
  (if (= 0 a)
     (setq a 0.0)
     (/ (* a 180.0) pi)
  )
)

Posted

What do you need help with? A little more info is needed!

Posted

attachment.php?attachmentid=57299&cid=1&stc=1 correct way

 

attachment.php?attachmentid=57300&cid=1&stc=1 Incorrect way

 

I have used this lsp command above (noob post!!) for years and only today has it started acting weird.. Sometimes it works, Sometimes it doesnt.. Same drawing,Same layers, Same linetypes..

 

Typing 'lilo' normally asks you to select your lighting column (blue symbols) then the Cable type (blue polyline) and it splits the polyline adding a neat split arrow between, simulating an underground cable on a highway lighting installation..

 

All help warmly received,

 

Thanks

Capture.jpg

Capture2.jpg

Posted

I am a typical CAD user and mainly draw electrical lighting designs on other peoples road or highway layouts. Often I Insert a block consisting only of 2 normal circles to represent a lighting column then draw a polyline behind each of the lighting columns. then using a lsp command (used in my department for years, which we have no idea who created it).. I click on each lighting column then click on the polyline(cable) and the routine adds in break into the cable and joins up to the centre of the lighting column.

 

Today its started to do weird things.. Sometimes it works, then it doesnt..

 

Same linetype, same layer, same way of doing it... Diff result?

 

tested on Acad 2014, 2015 and 2016...

Posted

A couple of things is line in 3d ie Z not zero each end, are you in a different UCS than Line ?

 

Also (setq line... this can cause problems as Line may be considered a reserved word use LLINE, also why use ssget "last" use (entlast) , DTR 25 why not 0.436332 then if DTR is missing still works.

Posted
A couple of things is line in 3d ie Z not zero each end, are you in a different UCS than Line ?

 

Also (setq line... this can cause problems as Line may be considered a reserved word use LLINE, also why use ssget "last" use (entlast) , DTR 25 why not 0.436332 then if DTR is missing still works.

 

Thanks for the reply, I didnt write the lsp routine and the file was last modified in 2004! so its an antique, but has worked for many years until recently.

 

I really dont understand any of your reply as I only use the commands, not write the routines..

 

If you could explain in very simple terms, I wil try and amend and let you know the outcome..

 

Thanks

 

Steve

Posted

LIST pick line and look to see if the Z values are not zero 0.0

 

also UCS W Plan

 

Post a dwg would be quickest

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