Results 1 to 7 of 7

Thread: Need Jumpover Lisp for Electrical Drawings

  1. #1
    100 Club mikehaff's Avatar
    Join Date
    2010-10
    Posts
    121

    Default Need Jumpover Lisp for Electrical Drawings

    I am working on electrical ladder and one-line drawings. On the drawings, where two wires cross but don't connect, the standard is to have a semicircle jump over on of the lines. Years ago I had a lisp routine that worked great. You would select the vertical line, then select all of the horizontal lines that jump over it. I would place all of the semicircles and appropriately trim the lines.

    Does anyone have anything like that or something close that I could modify?

  2. #2
    Moderator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    2,401

    Default Re: Need Jumpover Lisp for Electrical Drawings

    Quote Originally Posted by mikehaff View Post
    Years ago I had a lisp routine that worked great.
    That LISP (from years ago) should still work.
    "Potential has a shelf life." - Margaret Atwood

  3. #3
    AUGI Addict fixo's Avatar
    Join Date
    2005-05
    Location
    Pietari, Venäjä
    Posts
    1,217

    Default Re: Need Jumpover Lisp for Electrical Drawings

    Try this code on vertical and horizontal lines only
    Change gap to your suit within the code
    Code:
    (defun C:jmp(/ *error* ang bp1 bp2 elist1 elist2 entlist1 entlist2 gap ip osm nom pe1 pe2 ps1 ps2 sset1 sset2)
      (vl-load-com)
     (defun *error* (msg)
          (vla-endundomark (vla-get-activedocument
                  (vlax-get-acad-object))
    	      )
        (cond ((or (not msg)
    	       (member msg '("console break" "Function cancelled" "quit / exit abort"))
    	       )
    	   )
    	  ((princ (strcat "\nError: " msg)))
    	  )
        (setvar "cmdecho" 1)
        (if	osm
          (setvar "osmode" osm)
        )
        (if	nom
          (setvar "osmode" nom)
        )
        (princ)
        )
      (vla-startundomark (vla-get-activedocument
                  (vlax-get-acad-object))
    	      )
      (setq osm(getvar "OSMODE"))
      (setvar "OSMODE" 0)
      (princ "\nZoom objects to be visible on screen: ")
    (command "_.zoom" "w" pause pause)	 
    (setvar "nomutt" 0)
    (setq nom (getvar "nomutt"))
    	 
    (setvar "nomutt" 0)
    (princ "\nSelect vertical lines: ")
    (setvar "nomutt" 1)
    (setq sset1 (ssget ":L" '((0 . "line"))))
    (setvar "nomutt" 0)
    (princ "\nSelect horizontal lines: ")
    (setvar "nomutt" 1)
    (setq sset2 (ssget ":L" '((0 . "line"))))
    (setvar "nomutt" 0)
    (setq *gap* 4);<-- set your gap between lines here
    (setq gap (getreal (strcat "\nEnter a gap <" (rtos *gap*) ">: ")))
    (cond ((not gap)(setq gap *gap*)))
    (setq entlist1 (vl-remove-if 'listp(mapcar 'cadr (ssnamex sset1)))
          entlist2 (vl-remove-if 'listp(mapcar 'cadr (ssnamex sset2))))
    
    (foreach ent1 entlist1
      (setq elist1 (entget ent1))
      (setq ps1 (cdr (assoc 10 elist1)))
       (setq pe1 (cdr (assoc 11 elist1)))
      (foreach ent2 entlist2
         (setq elist2 (entget ent2))
      (setq ps2 (cdr (assoc 10 elist2)))
        (setq pe2 (cdr (assoc 11 elist2)))
        (setq ip (inters  ps2 pe2 ps1 pe1 nil))
        (setq ip (vlax-curve-getclosestpointto ent1 ip))
        (setq bp1 (polar ip 0 (/ gap 2)))
        (setq bp2 (polar ip pi (/ gap 2)))
        
        (command "_.break" bp1 bp2)
    
          (command "_.arc" bp1 "_E" bp2 "_A" 180.)
    
        )
    )
      (command "_.zoom" "p")
    (*error* nil)
      (princ)
      )
    (prompt "\n   >>>   Type JMP to execute...")
    (prin1)
    ~'J'~
    "The whole problem with the world is that fools and fanatics are always
    so certain of themselves, and wiser people so full of doubts."
    Bertrand Russell

  4. #4
    100 Club mikehaff's Avatar
    Join Date
    2010-10
    Posts
    121

    Default Re: Need Jumpover Lisp for Electrical Drawings

    Thanks Fixo! That's awesome. Can it be changed so the jumps are on the verticals? I would modify it myself but the code is too advanced for me.

  5. #5
    AUGI Addict fixo's Avatar
    Join Date
    2005-05
    Location
    Pietari, Venäjä
    Posts
    1,217

    Default Re: Need Jumpover Lisp for Electrical Drawings

    sorry was busy
    Try this one, minimally tested
    Code:
    (defun C:jmp(/ *error* ang ans bp1 bp2 elist1 elist2 entlist1 entlist2 gap ip osm nom pe1 pe2 ps1 ps2 sellist sset1 sset2 vflag)
      (vl-load-com)
     (defun *error* (msg)
          (vla-endundomark (vla-get-activedocument
                  (vlax-get-acad-object))
    	      )
        (cond ((or (not msg)
    	       (member msg '("console break" "Function cancelled" "quit / exit abort"))
    	       )
    	   )
    	  ((princ (strcat "\nError: " msg)))
    	  )
        (setvar "cmdecho" 1)
        (if	osm
          (setvar "osmode" osm)
        )
        (if	nom
          (setvar "osmode" nom)
        )
        (princ)
        )
      (vla-startundomark (vla-get-activedocument
                  (vlax-get-acad-object))
    	      )
      (setq osm(getvar "OSMODE"))
      (setvar "OSMODE" 0)
      (princ "\nZoom objects to be visible on screen: ")
    (command "_.zoom" "w" pause pause)	 
    (setvar "nomutt" 0)
    (setq nom (getvar "nomutt"))
    	 
    (setvar "nomutt" 0)
    (princ "\nSelect vertical lines: ")
    (setvar "nomutt" 1)
    (setq sset1 (ssget ":L" '((0 . "line"))))
    (setvar "nomutt" 0)
    (princ "\nSelect horizontal lines: ")
    (setvar "nomutt" 1)
    (setq sset2 (ssget ":L" '((0 . "line"))))
    (setvar "nomutt" 0)
    (setq *gap* 4);<-- set your gap between lines here
    (setq gap (getreal (strcat "\nEnter a gap <" (rtos *gap*) ">: ")))
    (cond ((not gap)(setq gap *gap*)))
    (setq entlist1 (vl-remove-if 'listp(mapcar 'cadr (ssnamex sset1)))
          entlist2 (vl-remove-if 'listp(mapcar 'cadr (ssnamex sset2))))
     (initget 1 "Vertical Horizontal" )
     (setq ans (getkword "\nChoose lines to be jumped over [Vertical/Horizontal] <H>:"))
    (if (eq ans "Vertical")(setq vflag t)(setq vflag nil))
    (if vflag (progn
    	    ;;swap references to selected objects :
    	    (setq sellist (list entlist1 entlist2)
    		  entlist2(car sellist)
    		  entlist1(cadr sellist))
    		
    	    (setq ang (/ pi 2))
    	    )
      (setq ang 0)
      )
    (foreach ent1 entlist1
      (setq elist1 (entget ent1))
      (setq ps1 (cdr (assoc 10 elist1)))
       (setq pe1 (cdr (assoc 11 elist1)))
      (foreach ent2 entlist2
         (setq elist2 (entget ent2))
      (setq ps2 (cdr (assoc 10 elist2)))
        (setq pe2 (cdr (assoc 11 elist2)))
        (setq ip (inters  ps2 pe2 ps1 pe1 nil))
        (setq ip (vlax-curve-getclosestpointto ent1 ip))
        (setq bp1 (polar ip ang (/ gap 2)))
        (setq bp2 (polar ip (+ ang pi) (/ gap 2)))
        
        (command "_.break" bp1 bp2)
    
          (command "_.arc" bp1 "_E" bp2 "_A" 180.)
    
        )
    )
      (command "_.zoom" "p")
    (*error* nil)
      (princ)
      )
    (prompt "\n   >>>   Type JMP to execute...")
    (prin1)
    ~'J'~
    "The whole problem with the world is that fools and fanatics are always
    so certain of themselves, and wiser people so full of doubts."
    Bertrand Russell

  6. #6
    100 Club mikehaff's Avatar
    Join Date
    2010-10
    Posts
    121

    Default Re: Need Jumpover Lisp for Electrical Drawings

    Thanks Fixo for your time. This works great!

  7. #7
    AUGI Addict fixo's Avatar
    Join Date
    2005-05
    Location
    Pietari, Venäjä
    Posts
    1,217

    Default Re: Need Jumpover Lisp for Electrical Drawings

    Glad you got it to working
    Cheers

    ~'J'~
    "The whole problem with the world is that fools and fanatics are always
    so certain of themselves, and wiser people so full of doubts."
    Bertrand Russell

Similar Threads

  1. Changing from Mechanical to Electrical drawings
    By ilyas in forum AMEP General
    Replies: 1
    Last Post: 2011-10-15, 03:55 PM
  2. 3rd party software for creating drawings of electrical components
    By michael.montano.contractor in forum AutoCAD General
    Replies: 0
    Last Post: 2008-11-03, 07:28 PM
  3. How to run a LISP routine on multiple drawings?
    By jmoore284 in forum AutoLISP
    Replies: 3
    Last Post: 2008-05-06, 05:24 AM
  4. UK Electrical CAD drawings needed
    By limartin in forum AutoCAD Electrical - General
    Replies: 5
    Last Post: 2007-01-09, 10:06 PM
  5. electrical drawings
    By tect75 in forum Revit Architecture - General
    Replies: 7
    Last Post: 2005-07-27, 08:59 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •