Connecting blocks with line or arc for electrical plans

Connecting blocks with line or arc for electrical plans

Anonymous
Not applicable
8,101 Views
32 Replies
Message 1 of 33

Connecting blocks with line or arc for electrical plans

Anonymous
Not applicable

Hi all,

 

I have been searching something similar all over web but no luck.

 

I need lisp that would ask for point 1 (specified by user) , insert block1 (ie. light switch), than ask point 2, insert block2 (ie. pendant light), draw a line (or an arc) connecting two, ask for point3, insert block3 (ie. light switch, again), connects it with block 2 and so on...

 

Hope I was clear with idea and it is possible to make...

I should start working on electrical plans and since so many people before me had same problem with this i hope someone already have it.

 

Thanks and hoping for some help.

 

Cheers

Jan 

0 Likes
8,102 Views
32 Replies
Replies (32)
Message 21 of 33

Anonymous
Not applicable

Thanks. This works now. 🙂

0 Likes
Message 22 of 33

Anonymous
Not applicable

Hi everybody,


Can you please upload the finished LISP for download? Thanks!

0 Likes
Message 23 of 33

Kent1Cooper
Consultant
Consultant

@Anonymous wrote:

.... Can you please upload the finished LISP for download? Thanks!


That could be any of several different versions, depending on how you want Object Snap handled.  Do you want to just run it with whatever Osnap mode(s) you have set at the time?  Or if you use it with Blocks, do you want to add INSert mode  to them if it's not already among them?  Or do you want to run it with INSert mode only, omitting any other mode(s) you may have set at the time?

Kent Cooper, AIA
0 Likes
Message 24 of 33

Anonymous
Not applicable

Well... I don't really know what you are asking me 🙂

I guess I would like to run it with whatever Osnap mode I have set at the moment.

My problem is that I downloaded LISP from previous page WA+, and it asks me to select blocs which I do, but nothing happens. When I try with lisp WA, it works - but it doesn't make a polyline. And what I would like is to select all blocs that I want to connect and have that arc-poly-line at the end.

I am sorry for not being more clear, but it's all new to me. Thanks!

0 Likes
Message 25 of 33

Kent1Cooper
Consultant
Consultant

@Anonymous wrote:

.... I would like to run it with whatever Osnap mode I have set at the moment.

My problem is that I downloaded LISP from previous page WA+, and it asks me to select blocs which I do, but nothing happens. When I try with lisp WA, it works - but it doesn't make a polyline.  And what I would like is to select all blocs that I want to connect and have that arc-poly-line at the end.

....


WA+ appears to be a more specific-limited-circumstance version, requiring specific types of selection.  And since it Trims the Arcs inside any Circles selected, a single Polyline result wouldn't be possible.

 

If you want to go with whatever Osnap mode(s) you have set, the first WA routine with the OSMODE setting removed should do.  But no, it doesn't make a Polyline --  the A in WA stands for Arcs, after all.  It could be made to do them all together in a Polyline [as in another very recent thread], but if you're talking about selecting Block objects, rather than picking on locations, questions arise.  Would you be willing to select the Blocks one at a time, with the order of selection used for the route of the Polyline?  If you want to select them in a window or something, is there some relationship that can be relied on for a routine to decide how to move between them?  I think there are other threads with routines that do pretty much that, if you do some Searching.

Kent Cooper, AIA
0 Likes
Message 26 of 33

Anonymous
Not applicable

Ok, I get it.

Thank you!

0 Likes
Message 27 of 33

Anonymous
Not applicable

 Can the arcs be connected into a polyline after finishing the command?

0 Likes
Message 28 of 33

Kent1Cooper
Consultant
Consultant

@Anonymous wrote:

 Can the arcs be connected into a polyline after finishing the command?


 

The drawing of the Arc could be followed by JOINing it to whatever precedes [if anything].  In either @hmsilva's routine in Message 12, or mine in Message 20, try following the (command) function that draws the Arc with this [untested]:

 

          (if joined; is there a cumulative Polyline already?

            (command "_.join" joined (entlast)); then ['joined' retains entity name]

            (progn ; else -- turn Arc into start of 'joined'

              (setq pea (getvar 'peditaccept))

              (setvar 'peditaccept 1); just in case

              (command "_.pedit" (entlast) ""); turn into Polyline [new entity name]

              (setvar 'peditaccept pea)

              (setq joined (entlast))

            ); progn

          ); if

 

Alternatively, the "arcs" could be drawn directly as single Polyline  arc segments, to eliminate the need for much of the 'else' argument above.  That would require changing the command name and prompt sequence in the way the arcs are drawn, but wouldn't be difficult.

 

In either case, add joined to the list of localized variables at the beginning of the command definition.

 

Looking back, I notice the link in Message 25 -- check that out, too.

Kent Cooper, AIA
Message 29 of 33

Anonymous
Not applicable

I'm really sorry, I'm kind of new to the lisp language and I'm not sure I followed your instructions correctly. If this is the sequence, it's not working. But the more possible scenario is that  I messed something up. Could you help me to make this work?

 

(defun C:WA (/ *error* osm pt1 pt2); = Wiring Arcs
(defun *error* (errmsg)
(if (not (wcmatch errmsg "Function cancelled,quit / exit abort,console break"))
(princ (strcat "\nError: " errmsg))
); if
(setvar 'osmode osm)
); defun - *error*
(setq osm (getvar 'osmode))
(setvar 'osmode 64); Insertion
(setq pt1 (getpoint "\nStart point for Arc(s): "))
(while (setq pt2 (getpoint "\nEnd of Arc: "))
(command
"_.arc" pt1 "_e" pt2 "_direction" ; [spelling out "_end" is taken as Osnap call]
(angtos (apply (if (> (car pt2) (car pt1)) '+ '-) (list (angle pt1 pt2) (/ pi 5))))
; change 5 above to lower number for more bulge, higher for less
); command
(if joined; is there a cumulative Polyline already?
(command "_.join" joined (entlast)); then ['joined' retains entity name]
(progn ; else -- turn Arc into start of 'joined'
(setq pea (getvar 'peditaccept))
(setvar 'peditaccept 1); just in case
(command "_.pedit" (entlast) ""); turn into Polyline [new entity name]
(setvar 'peditaccept pea)
(setq joined (entlast))
); progn
); if
(setq pt1 pt2); for start of next Arc
); while
(setvar 'osmode osm)
); defun

 

0 Likes
Message 30 of 33

tranhung_iuh
Participant
Participant

Firstly. I really thank you for the lisp cad you wrote.
Can you edit it a bit then? I want arc curves to connect the blocks together at the insertion point.
It would be great if you received this message.

0 Likes
Message 31 of 33

ВeekeeCZ
Consultant
Consultant

So just remove the TRIM part from the code.

"_.TRIM" "" pt1 pt2 ""

0 Likes
Message 32 of 33

tranhung_iuh
Participant
Participant

Is there a way to make the arcs pass through the blocks' insertion point instead of the center point? Hope you can help me fix this

tranhung_iuh_0-1699320442459.png

 

0 Likes
Message 33 of 33

viejaytabago02
Participant
Participant

Hello Sir,

Is it possible to place the arc only in the quadrant of the block as shown in the attached photo? thank you.

0 Likes