lamensterms 发表于 2022-7-6 08:39:48

Insert and explode a block - w

Hey guys,
 
Ive got this routine ive been working on - to draw a squiggly boundary around enlarged details... but im having trouble getting the block to insert and explode with the polyline being left as a result.
 
Im sure im overlooking something pretty simple... any help and advice would be greatly appreciated.
 

(defun C:sdb (/ PT1 PT2 Xdist Ydist)(setvar "cmdecho" 0)(setq PT1 (GETPOINT "\nPick Insertion Point (bottom left corner of detail)... "))(setvar "orthomode" 0)(setq PT2 (GETPOINT PT1 "\nPick point on opposite side of detail (top right corner of detail)... "))(setvar "osmode" 0)(setq Xdist (abs (- (car Pt1) (car Pt2))))(setq Ydist (abs (- (cadr Pt1) (cadr Pt2))))(COMMAND "INSERT" "sdb" PT1 Xdist Ydist "" "explode" "L")(terpri))
 
is the code... the block DWG is attached.
 
What im finding is that when i insert the block (which contains a simple polyline) - it will be inserted as a BLOCK REFERENCE.If i explode this BLOCK REFERENCE (after the insert command) im left with a bunch of lines (not a joined, closed polyline).It seems there are 2 explodes being executed.
 
If i try to explode the block during the insert routine (ie "-insert" "*SDB")... then the scale factor is applied uniformly and the routine will not be executed correctly.
 
Hopefully there is a simple fix for this.
 
cheers.
 
SDB.DWG

eldon 发表于 2022-7-6 09:18:14

I think that you are being banjaxed by AutoCAD.
 
If you insert and explode a block with equal scaling, then a polyline stays a polyline. If you insert a block with unequal scaling, then the polyline does NOT stay a polyline.
 
You will have to add a bit to reconstitute your polyline.

lamensterms 发表于 2022-7-6 10:09:02

hi eldon, thanks a lot for your reply.
 
so this is on of the rules of polyline/block inserting built into AutoCAD?
 
Thanks for the info - i shall pursue another avenue to achieve this.
 
Cheers.
页: [1]
查看完整版本: Insert and explode a block - w