Announcements

The Autodesk Community Forums has a new look. Read more about what's changed on the Community Announcements board.

create an outline of selected blocks

MaccyDee
Enthusiast

create an outline of selected blocks

MaccyDee
Enthusiast
Enthusiast

trying to find a lisp routine that will create and outline of selected blocks/objects if possible.

for context, im drawing rows of fridges which contain several blocks (a block for the end panel, the fridge body itself and the opposite end panel), sometimes theres several fridges together in a row called a 'system' (e.g. end panel, fridge, fridge, fridge, end panel)

i then need to create a poly-line around each "run" of fridges (from end panel to end panel). i provided an example below, the white poly-line is the outline that goes around a single fridge, and the gaps at the side panels is exaggerated to make it clearer where the blocks end (usually flush against).

 

its easy enough to do it manually, however these jobs have many fridges (supermarket refrigeration) and it would save a lot of time if i could just select the blocks that need the outline (even if it can only be done one 'system' at at time) 

 

 

in the mean time im going to attempt to write a lisp (good luck to me!)

 

(i attached a dwg. with the poly line and a set of blocks if anyone wants to try and play around and make a lisp themselves)

 

i hope that all makes sense, thanks in advance.

 

 

Capture.PNG

0 Likes
Reply
Accepted solutions (1)
3,333 Views
13 Replies
Replies (13)

ennujozlagam
Mentor
Mentor

https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/draw-outline-of-blocks/td-p/1147797

 

https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/create-the-outline-automatically-by-...





Remember : without the difficult times in your LIFE, you wouldn't be who you are today. Be grateful for the good and the bad. ANGER doesn't solve anything. It builds nothing, but it can destroy everything...
Please mark this response as "Accept as Solution" if it answers your question. Kudos gladly accepted.
0 Likes

MaccyDee
Enthusiast
Enthusiast
thanks, but neither of these accomplsh what im looking for.

basically need a poly line to be drawn around the outside of selected blocks
0 Likes

hak_vz
Advisor
Advisor

@MaccyDee 

Attach sample drawing with example of how you want to have your outline created.

Miljenko Hatlak

EESignature

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
0 Likes

Sea-Haven
Mentor
Mentor

Looking at your sample dwg joined the 4mm gap at top and bottom with a line, x 2, then drew random pline around shape, then did bpoly it makes a pline close to what you want can be dragged quickly to correct shape.

 

Because your block has an outside line that you don't want to use its hard to think of a easy way to wrap random blocks.

0 Likes

ronjonp
Advisor
Advisor

@MaccyDee  If this linework is needed at the end why not include it within the block definition on a no plot layer?

Then something as simple as this should work ( untested ).

(defun c:foo (/ s)
  (if (setq s (ssget ":L" '((0 . "INSERT"))))
    (foreach e (vl-remove-if 'listp (mapcar 'cadr (ssnamex s)))
      (foreach o (vlax-invoke (vlax-ename->vla-object e) 'explode)
	(if (= "ALLIANCE_COLOUR-OUTLINE" (strcase (vla-get-layer o)))
	  (vla-put-color o 1)
	  (vl-catch-all-apply 'vla-delete o)
	)
      )
    )
  )
  (princ)
)
0 Likes

john.uhden
Mentor
Mentor

@ronjonp

I'm not sure it's a great idea to explode his blocks, BUT

there's no harm in exploding a (vla-copy) of his block, then grabbing what you need and deleting the broken pieces.

Does the explode method also leave a selection set "_P" like the EXPLODE command?

John F. Uhden

0 Likes

MaccyDee
Enthusiast
Enthusiast

this is how they should look/act, i provided three different, typical types of case layout, the angled cases for example have a double patch end in the center of the case run, the vertical cases run share a patch end,  and the horizontal cases are connected without a shared patch end

0 Likes

Sea-Haven
Mentor
Mentor

Taking some of the ideas above I copied the 3 examples a fixed amount to the right, and exploded the blocks, converted to continuous linetype, isolated the purple layer added the 4mm line gap which as suggested needs to exist say on no plot layer.  

 

Then a simple pline around the objects and used bpoly this made the outline required so hatched that then moved it back the set amount to left ie all done. I had to remove the doors also. 

 

Need more time to automate. The main problem is standard layers and need color to be used.

 

SeaHaven_1-1643343403259.png

 

 

0 Likes

MaccyDee
Enthusiast
Enthusiast

Ah yeah i can see where youre goin with this, if it makes it easier the doors can be drawn on a their own layer similar to the air gap layer, which you could then turn off to make the bpoly and then switch it back on (?)

 

i may just be talking jibberish though, still fairly new to autocad and drafting in general

0 Likes

Sea-Haven
Mentor
Mentor

Your heading in right direction, the 4mm line gap needed could it not be in same layer as fridges it would not look to obvious on a plot ? Put doors on seperate layer YES.

 

So sequence becomes copy, pick point, drag mouse to right -> type 50000 Enter, explode etc layiso, pick purple, draw random pline as outline, then bpoly, a pline will appear around fridges, hatch -> pick pline, move Last, pick pt drag mouse left <- type 50000, layuniso, erase junk on right, all done.

 

Get this sequence to work 1st then it could be automated to a selection and maybe a pick. Consistency in dwg Standards creeps in what layers and so on.

 

 

0 Likes

Kent1Cooper
Consultant
Consultant
Accepted solution

I would make a non-plotting casework Layer, and on it add 2mm pieces to the Block definition at all four corners [white here]:

Kent1Cooper_0-1643635880743.png

Then, isolating just that Layer and the casework outline Layer, the gaps will be closed, with no additional pieces to draw and no Copying or Exploding.  You [or a routine] can just draw a big temporary Circle or Rectangle or something, larger than all of it, use BOUNDARY to make the outline, and delete the temporary outline and the Boundary result piece that overlays it, leaving just the one around the cases.

 

Kent Cooper, AIA
0 Likes

MaccyDee
Enthusiast
Enthusiast
youre onto something here! i tried it without the non-plot wingy bits as well and it seems to work fine, just draw a box around what you want outlined and select everything and let island detection work its magic (doors still need to be on own layer).
now we just need someone to automate drawing a small boundary around selected cases, isolating case and outline layer, drawing the outline, delete the outer boundary and un-isolate
0 Likes

Sea-Haven
Mentor
Mentor

Found the person to do the automation his name is darien !

0 Likes