Jump to content

Recommended Posts

Posted

Hi mates,

 

Good day to all :), is there any of there having a Lsp route on electrical wiring that will pick first fixture then the second fixture will automatically create a standard wiring pline as shown to the image.

 

The first pick will be line angle 45 degrees and then it will be bend horizontal or vertical line about 100mm far to the lighing fixture and in the next lighting fixture will bend 45 degrees again that will be the second pick for the next lighting fixture and then it will fillet by 150mm dia on each bend.:roll: this will be continious to the other lighting fixtures

 

Please provided me so that it will be easier on my life to work on electrical wirings:lol:

WIRE.jpg

Posted

Here is a quicky :)

;; CAB 05.12.09
;;  Draw Electric Wire
(defun c:ew (/ ew_layer p1 p2 msg)
 (setq ew_layer "Wire")      ; layer name

 (defun draw-ew (p4 p1 lay / p2 p3)
   (setq p2 (polar p1 (- (angle p1 p4) (/ pi ) 57.40259411)
         p3 (polar p4 (+ (angle p4 p1) (/ pi ) 57.40259411)
   )
   (entmakex
     (list '(0 . "LWPOLYLINE")
           '(100 . "AcDbEntity")
           '(100 . "AcDbPolyline")
           (cons 8 lay)
           (cons 90 4)
           '(70 . 0)         ; 1 for closed 0 overwise
           (cons 10 p1)
           '(40 . 0.0)
           '(41 . 0.0)
           '(42 . 0.198912)
           (cons 10 p2)
           '(40 . 0.0)
           '(41 . 0.0)
           '(42 . 0.0)
           (cons 10 p3)
           '(40 . 0.0)
           '(41 . 0.0)
           '(42 . 0.198913)
           (cons 10 p4)
           '(40 . 0.0)
           '(41 . 0.0)
           '(42 . 0.0)
     )
   )
 )

 (setq p1 (getpoint "\nPick start point (Draw clockwise"))
 (setq msg "\nPick next point clockwise.")
 (while (setq p2 (getpoint p1 msg))
   (draw-ew p1 p2 ew_layer)
   (setq p1 p2)
 )

 (princ)

)
(prompt "\nElectric Wire loaded, Enter EW to run.")
(princ)

Posted

Perfect!!! :lol: this is all i needed. Thanks CAB :)

 

 

;; CAB 05.12.09
;;  Draw Electric Wire
(defun c:ew (/ ew_layer p1 p2 msg)
 (setq ew_layer "Wire")      ; layer name

 (defun draw-ew (p4 p1 lay / p2 p3)
   (setq p2 (polar p1 (- (angle p1 p4) (/ pi ) 57.40259411)
         p3 (polar p4 (+ (angle p4 p1) (/ pi ) 57.40259411)
   )
   (entmakex
     (list '(0 . "LWPOLYLINE")
           '(100 . "AcDbEntity")
           '(100 . "AcDbPolyline")
           (cons 8 lay)
           (cons 90 4)
           '(70 . 0)         ; 1 for closed 0 overwise
           (cons 10 p1)
           '(40 . 0.0)
           '(41 . 0.0)
           '(42 . 0.198912)
           (cons 10 p2)
           '(40 . 0.0)
           '(41 . 0.0)
           '(42 . 0.0)
           (cons 10 p3)
           '(40 . 0.0)
           '(41 . 0.0)
           '(42 . 0.198913)
           (cons 10 p4)
           '(40 . 0.0)
           '(41 . 0.0)
           '(42 . 0.0)
     )
   )
 )

 (setq p1 (getpoint "\nPick start point (Draw clockwise"))
 (setq msg "\nPick next point clockwise.")
 (while (setq p2 (getpoint p1 msg))
   (draw-ew p1 p2 ew_layer)
   (setq p1 p2)
 )

 (princ)

)
(prompt "\nElectric Wire loaded, Enter EW to run.")
(princ)

Posted

Hi CAB,

 

the wiring Lsp is greate CAB,:) but i have some problem regarding when i use it on a rotated UCS plan the layout will not appear on the lighting fixture, it will will go away according to 0.0 UCS.:unsure: can you fix it on this causes. Thanks again:lol:

Posted

NICE! i changed it to have straight 45 edges and it work flawlessley :D

Posted

How did you change it? :o

 

 

 

NICE! i changed it to have straight 45 edges and it work flawlessley :D

Posted

Try this for UCS:

;; CAB 05.13.09
;;  Draw Electric Wire
(defun c:ew (/ ew_layer p1 p2 msg)
 (setq ew_layer "Wire")      ; layer name

 (defun draw-ew (p4 p1 lay / p2 p3)
   (setq p2 (polar p1 (- (angle p1 p4) (/ pi ) 57.40259411)
         p3 (polar p4 (+ (angle p4 p1) (/ pi ) 57.40259411)
   )
   (entmakex
     (list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") '(100 . "AcDbPolyline")
           (cons 8 lay)
           (cons 90 4)
           '(70 . 0)         ; 1 for closed 0 overwise
           (cons 10 (trans p1 1 0)) '(40 . 0.0) '(41 . 0.0) '(42 . 0.198912)
           (cons 10 (trans p2 1 0)) '(40 . 0.0) '(41 . 0.0) '(42 . 0.0)
           (cons 10 (trans p3 1 0)) '(40 . 0.0) '(41 . 0.0) '(42 . 0.198913)
           (cons 10 (trans p4 1 0)) '(40 . 0.0) '(41 . 0.0) '(42 . 0.0)
           '(210 0.0 0.0 1.0)
     )
   )
 )

 (and
   (setq p1 (getpoint "\nPick start point (Draw clockwise"))
   (setq msg "\nPick next point clockwise.")
   (while (setq p2 (getpoint p1 msg))
     (draw-ew p1 p2 ew_layer)
     (setq p1 p2)
   )
 )
 (princ)

)
(prompt "\nElectric Wire loaded, Enter EW to run.")
(princ)

  • Like 1
  • 2 years later...
Posted

I have no Idea how to change lisp's - I need it to have 45 degree chamfers with a lenth of 250mm I dont know if this is possible and that someone could please do this for me id be very very greatful

 

:)

  • 2 years later...
Posted

First of all, thank CAB very much.

Hi Nick-H-. I have change a litle bit in source for easy to understand.

;; CAB 05.13.09
;;  Draw Electric Wire
(defun c:ew (/ ew_layer p1 p2 msg height ang)
 (setq ew_layer (getvar "CLAYER"))    ; set current layer
 (setq height (/ 2.5 (getvar "CANNOSCALEVALUE")))    ; set chamfer height
 (setq ang 45)                ; set chamfer angle

 (defun draw-ew (p4 p1 lay / p2 p3)
   (setq p2 (polar p1 (- (angle p1 p4) (/ (* ang pi) 180)) height)
     p3 (polar p4 (+ (angle p4 p1) (/ (* ang pi) 180)) height)
   )
   (entmakex
     (list
   '(0 . "LWPOLYLINE")
   '(100 . "AcDbEntity")
   '(100 . "AcDbPolyline")
   (cons 8 lay)
   (cons 90 4)
   '(70 . 0)            ; 1 for closed 0 overwise
   (cons 10 (trans p1 1 0))
       '(40 . 0.0)
       '(41 . 0.0)
       '(42 . 0.0)
   (cons 10 (trans p2 1 0))
       '(40 . 0.0)
       '(41 . 0.0)
       '(42 . 0.0)
   (cons 10 (trans p3 1 0))
       '(40 . 0.0)
       '(41 . 0.0)
       '(42 . 0.0)
   (cons 10 (trans p4 1 0))
       '(40 . 0.0)
       '(41 . 0.0)
       '(42 . 0.0)
   '(210 0.0 0.0 1.0)
     )
   )
 )

 (and
   (setq p1 (getpoint "\nPick start point (Draw clockwise"))
   (setq msg "\nPick next point clockwise.")
   (while (setq p2 (getpoint p1 msg))
     (draw-ew p1 p2 ew_layer)
     (setq p1 p2)
   )
 )
 (princ)

)

In this code I add new variable height and ang to control height and angle of chamfer. But I fix this with value 2.5*Layout Scale and 45 degree.

Do anybody know how to make option to control this variable like this?

Command: EW

(Height / Angle / Draw): Pick start point (Draw clockwise)

When click Height, Angle this go to setting Height and Angle variable.

  • 1 year later...
Posted

can you make the circuit line like image i uploaded , 45 degree line and the corner is filleted. and it's that possible that when we call a cmd and it ask for enter the fillet radius and the distance between fixture and circuit line

 

pls do a needfull.

  • 3 years later...
Posted

hi friends i dont know more about the autolisp but i want that lisp for cad 2019 

the file and the appreviation please 

Posted

Copy the code from ctsonhcm post to notepad and save as say elecwire.lsp then use appload to load it or drag and drop onto Autocad type ew to run.

  • 1 year later...
Posted

can I edit this to draw an arc instead of a poly line !! 

and thanks a lot guys 

  • 2 months later...
Posted
On 8/29/2021 at 2:30 AM, Ali Abdulfattah said:

can I edit this to draw an arc instead of a poly line !! 

and thanks a lot guys 

I am wondering this also, as well as for creating a SPLINE.

Posted

There is at least 4 different style of answer in the old image. I have somewhere pick 1. Pick 1 has a left and right option. Start is another.

 

You need to post a true dwg of what you want.

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