Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Draw Electric Wire

26 REPLIES 26
SOLVED
Reply
Message 1 of 27
ndnam7693
6937 Views, 26 Replies

Draw Electric Wire

Hello Everyone,

I'm have some problem with Draw Electric Wire Lisp. When I draw Socket outlet line ( refer attach pics). Set Angle is 45 degree. Now, I want to change this angle by fillet. I already upload Draw Electric Wire Lisp. Help me. I come from Viet Nam

With Angle is 45 degree

Capture.PNG

With Fillet make by Fillet command.

Capture1.PNG

Tags (1)
26 REPLIES 26
Message 21 of 27
_Tharwat
in reply to: ahmedmohamm
Message 22 of 27
Kent1Cooper
in reply to: ahmedmohamm


@ahmedmohamm wrote:

... it should depend on the path the wire was originally coming from in the previous block as shown


Adding numbers, and assuming working left-to-right from 1 through 6, your image suggests that you mean it should take off from the opposite side of the Block from where the previous wire came in, that is, it should go out the right side of #2 to head toward #3, rather than taking the possible route going out the top side of #2, and likewise it should go out the right side of #5 rather than the bottom side.

Kent1Cooper_0-1676906645916.png

But that doesn't really answer it.  Whether you're coming at it from 1 through 6 or the other way from 6 through 1, it would seem that at #4, the route from there to the next one is a function of where the next one is, and not a function of where the path arrived coming from the previous one.  Does the whole thing depend on whether there's a continuation of the direction of the path at a given Block, or a change in direction, and if a change, whether that's a perpendicular change in direction at the Block, or a diagonal direction so that a perpendicularly bent path needs to be taken?  It seems to me that only in the latter case does the direction the path arrived from the previous Block enter the picture -- otherwise, only the direction to the next one matters.

 

Your newer image also suggests that you would never actually want the route shown in Message 15.

Kent Cooper, AIA
Message 23 of 27
smallƑish
in reply to: ahmedmohamm
Message 24 of 27
Sunny2006
in reply to: ВeekeeCZ


I have a humble submission, as am a user of your arc PLA code.

https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/draw-polyline-arc-circuits-it-essent...

The flip last option is very useful. Is that possible to be applicable to add the same for your EW code also?

Message 25 of 27
ВeekeeCZ
in reply to: Sunny2006


@Sunny2006 wrote:


I have a humble submission, as am a user of your arc PLA code.

https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/draw-polyline-arc-circuits-it-essent...

The flip last option is very useful. Is that possible to be applicable to add the same for your EW code also?


 

Ok, flip option it is.

 

(defun c:EW (/ draw-ew lay p1 p2 ang flip)

  (defun draw-ew (p4 p1 lay hgh sid / p2 p3)
    (setq p2 (polar p1 ((if sid + -) (angle p1 p4) (/ (* ang pi) 180)) hgh)
          p3 (polar p4 ((if sid - +) (angle p4 p1) (/ (* ang pi) 180)) hgh))

    (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))))

  ; --------------------------------------------------------------------------------------------------------------------------


  (setq lay "EL-LT-CABL-160"
        ang 45)

  (or (tblsearch "LAYER" lay)
      (command "_.-LAYER" "_N" lay "_C" 160 lay ""))
  
  (cond ((or (not *ew-height*)
             (not (setq p1 (getpoint (strcat "\nPick start point  ")))))
         (setvar 'filletrad (cond ((getdist (strcat "\nWire radius <" (rtos (getvar 'filletrad)) ">: ")))
                                  ((getvar 'filletrad))))
         (or *ew-height*
             (setq *ew-height* (getvar 'filletrad)))
         (setq *ew-height* (cond ((getdist (strcat "\nChamfer height <" (rtos *ew-height*) ">: ")))
                                 (*ew-height*)))
         (setq p1 (getpoint "\nPick start point: "))))

  (while (progn (initget "flipLast andKeepit") (setq p2 (getpoint p1 (strcat "\nPick new point" (if p0 " [flipLast/andKeepit]" "") ": "))))
    (cond ((= "flipLast" p2)	(command  "_.erase" "_l" "" "_.fillet" "_P" (draw-ew p0 p1 lay *ew-height* (not flip))))
	  ((= "andKeepit" p2)   (command  "_.erase" "_l" "" "_.fillet" "_P" (draw-ew p0 p1 lay *ew-height* (setq flip (not flip)))))
	  (T 			(command  "_.fillet" "_P" (draw-ew p1 (setq p0 p1 p1 p2) lay *ew-height* flip)))))
  
  (princ)
  )

 

Message 26 of 27
Sunny2006
in reply to: ВeekeeCZ

@ВeekeeCZ  you are the hero. loved it. 

A million thanks to you!

I wish to add this but don't know where to add

 

 

(setq usermode (getvar"osmode"))
(setvar "osmode" 4)
..
..
..
(setvar "osmode" usermode)

 

 

 

 

Message 27 of 27
smallƑish
in reply to: ВeekeeCZ

Flip and flip and keep. Simply awesome @ВeekeeCZ . 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report