(if (setq sstSelection (ssget "x" '((0 . "insert")(67 . 0))))
(repeat (setq i (sslength sstSelection))
(setq ent (ssname sstSelection (setq i (1- i))))
(vla-explode (vlax-ename->vla-object ent))
(vla-delete (vlax-ename->vla-object ent))
)
)
(if (setq sstSelection (ssget "x" '((0 . "insert")(67 . 0))))
(repeat (setq i (sslength sstSelection))
(command-s "_.explode" (ssname sstSelection (setq i (1- i))))
)
)
But using this code takes very long and i would like to find a faster solution.Hi, yes.
Simply said i want the same result as if i use this codeCode: [Select](if (setq sstSelection (ssget "x" '((0 . "insert")(67 . 0))))
But using this code takes very long and i would like to find a faster solution.
(repeat (setq i (sslength sstSelection))
(command-s "_.explode" (ssname sstSelection (setq i (1- i))))
)
)
Sometimes there are drawing with hundrets of block sometimes nested etc.
It would also be great to learn why this blocks behaves like this when using vla-explode. I thinks the Constraints in the block but no idea why its changing.
...
But using this code takes very long and i would like to find a faster solution.
Sometimes there are drawing with hundrets of block sometimes nested etc.
It would also be great to learn why this blocks behaves like this when using vla-explode. I thinks the Constraints in the block but no idea why its changing.
Off topic, but why are you exploding the block ?
Here is some code to convert the block to staticAllready tried something like this. As long as the constraints stay in the block the problem stays.
Someone knows a way how to delete theese out of the block before/while exploding?
Perhaps you'd consider performing this task in .NET, or instead simply export the drawing back to 2000 format (maybe older; whichever version does this for you at export)?
Since you're working on a drawing in the editor, can you not first call DELCONSTRAINT Command?
Since you're working on a drawing in the editor, can you not first call DELCONSTRAINT Command?
The constraints are in the blocks so i would have to do this in the blockeditor for every block.
This probably wouldn't make the programm much faster than using (command-s "_.explode" ....) for every block^^
Off topic, but why are you exploding the block ?
I have to write a program to clean up dwg-files making them as small as possible.
...
Wouldn't exploding all the blocks make the drawing larger ?Of course i purge the drawing after exploding. My guideline is to make the drawing complettly clean so there is nothing left but single elements.
Here's a way to strip the constraints ( use with caution as it's a lobotomy ) :)
I tested and seemd to fix the vla-explode problem.Code - Auto/Visual Lisp: [Select]
) (_stripconstraint)
Maybe this can work?Is it right that you "redraw" the elements of the block and then delete it?.
Here's a way to strip the constraints ( use with caution as it's a lobotomy ) :)
Maybe this can work?This code works fine for the block but running this program over all blocks in a drawing doesn't work.Code - Auto/Visual Lisp: [Select]
) ) mat '((0.0 0.0 0.0 1.0)) ) ) ) ) ) ) ;; RefGeom (gile) ;; Returns a list whose first item is a 3x3 transformation matrix and ;; second item the object insertion point in its parent (xref, block or space) ) (list (setq mat (mxm '( (1.0 0.0 0.0) (0.0 1.0 0.0) (0.0 0.0 1.0) ) ) (mxm (list '(0.0 0.0 1.0) ) (list ) ) ) ) ) ) ) ;; Matrix Transpose - Doug Wilson ;; Args: m - nxn matrix ) ;; Matrix x Matrix - Vladimir Nesterovsky ;; Args: m,n - nxn matrices ) ;; Matrix x Vector - Vladimir Nesterovsky ;; Args: m - nxn matrix, v - vector in R^n )
Fehler: Fehlerhafter Argumenttyp: lentityp ((-1 . <Objektname: 7ffffb07640>) (0 . "POINT") (330 . <Objektname: 7ffffb07620>) (5 . "31C") (100 . "AcDbEntity") (67 . 0) (8 . "Verband_wo") (62 . 7) (100 . "AcDbPoint") (10 0.0 -1961.0 0.0) (210 0.0 0.0 1.0) (50 . 0.0))
Here's a way to strip the constraints ( use with caution as it's a lobotomy ) :)
I tested and seemd to fix the vla-explode problem.Code - Auto/Visual Lisp: [Select]
) (_stripconstraint)
That's the dictionary I couldn't remember for the life of me; thanks for the reminder. :)
I was reading a DevBLog article on adding geometric constraints in C#... Stephen was the author, or a contributor if memory serves.
Here's a way to strip the constraints ( use with caution as it's a lobotomy ) :)
I tested and seemd to fix the vla-explode problem.Code - Auto/Visual Lisp: [Select]
) (_stripconstraint)
That's the dictionary I couldn't remember for the life of me; thanks for the reminder. :)
I was reading a DevBLog article on adding geometric constraints in C#... Stephen was the author, or a contributor if memory serves.
:) Had to do a little searching .. not sure what, if any side effects will happen when deleting.
Maybe this can work?Is it right that you "redraw" the elements of the block and then delete it?.
As i'm realatively new to Lisp i would really like to know why the block behaved the way it did before ur help?
Maybe this can work?This code works fine for the block but running this program over all blocks in a drawing doesn't work.Code - Auto/Visual Lisp: [Select]
< ... >
I add dwg-file with thoose blocks. Block2 and Block3 make problems.
In my experience, exploding blocks will generally make the files larger, not smaller.QuoteOff topic, but why are you exploding the block ?
I have to write a program to clean up dwg-files making them as small as possible.
My program allready works, but the part exploding blocks in drawing works only with (command-s "_.explode" ....).
As there are really big dwgs with many blocks this sometimes takes a while.QuoteHere is some code to convert the block to staticAllready tried something like this. As long as the constraints stay in the block the problem stays.
When i manually delete the constraints in the Blockeditor and then use the vla-explode it works fine.
Someone knows a way how to delete theese out of the block before/while exploding?
In my experience, exploding blocks will generally make the files larger, not smaller.QuoteOff topic, but why are you exploding the block ?
I have to write a program to clean up dwg-files making them as small as possible.
My program allready works, but the part exploding blocks in drawing works only with (command-s "_.explode" ....).
As there are really big dwgs with many blocks this sometimes takes a while.QuoteHere is some code to convert the block to staticAllready tried something like this. As long as the constraints stay in the block the problem stays.
When i manually delete the constraints in the Blockeditor and then use the vla-explode it works fine.
Someone knows a way how to delete theese out of the block before/while exploding?
In my experience, exploding blocks will generally make the files larger, not smaller.I think i explained a little bit wrong. Goal is to clean the drawing.
Because some (but perhaps not all) of the various constraints would still be present, causing the objects to be contorted as they are manipulated by AutoCAD to meet the remaining constraints.Thought something like this. Because the behaviour changes by moving or turning the block before exploding.
So actually your intent is NOT to ensure the file is as small as it possibly can be. It's rather to make it a flat file without any reused blocks.In my experience, exploding blocks will generally make the files larger, not smaller.I think i explained a little bit wrong. Goal is to clean the drawing.
When i'm done i put the result together in one block.
Block Definitions
Block1
Line1 X,Y,Z to X,Y,Z Layer Color etc.
Line2 X,Y,Z to X,Y,Z Layer Color etc.
Line3 X,Y,Z to X,Y,Z Layer Color etc.
Model Elements
Block1-Insert1 @ X,Y,Z Rotate Scale Layer Color etc.
Block1-Insert2 @ X,Y,Z Rotate Scale Layer Color etc.
Block1-Insert3 @ X,Y,Z Rotate Scale Layer Color etc.
Block1-Insert4 @ X,Y,Z Rotate Scale Layer Color etc.
After exploding that same file becomes something like this instead:Model Elements
Line1.1 X,Y,Z to X,Y,Z Layer Color etc.
Line1.2 X,Y,Z to X,Y,Z Layer Color etc.
Line1.3 X,Y,Z to X,Y,Z Layer Color etc.
Line2.1 X,Y,Z to X,Y,Z Layer Color etc.
Line2.2 X,Y,Z to X,Y,Z Layer Color etc.
Line2.3 X,Y,Z to X,Y,Z Layer Color etc.
Line3.1 X,Y,Z to X,Y,Z Layer Color etc.
Line3.2 X,Y,Z to X,Y,Z Layer Color etc.
Line3.3 X,Y,Z to X,Y,Z Layer Color etc.
Line4.1 X,Y,Z to X,Y,Z Layer Color etc.
Line4.2 X,Y,Z to X,Y,Z Layer Color etc.
Line4.3 X,Y,Z to X,Y,Z Layer Color etc.
So the more copies of the same block you explode the more new lines you're actually placing in the drawing's model.Block Definitions
Block1
Line1.1 X,Y,Z to X,Y,Z Layer Color etc.
Line1.2 X,Y,Z to X,Y,Z Layer Color etc.
Line1.3 X,Y,Z to X,Y,Z Layer Color etc.
Line2.1 X,Y,Z to X,Y,Z Layer Color etc.
Line2.2 X,Y,Z to X,Y,Z Layer Color etc.
Line2.3 X,Y,Z to X,Y,Z Layer Color etc.
Line3.1 X,Y,Z to X,Y,Z Layer Color etc.
Line3.2 X,Y,Z to X,Y,Z Layer Color etc.
Line3.3 X,Y,Z to X,Y,Z Layer Color etc.
Line4.1 X,Y,Z to X,Y,Z Layer Color etc.
Line4.2 X,Y,Z to X,Y,Z Layer Color etc.
Line4.3 X,Y,Z to X,Y,Z Layer Color etc.
Model Elements
Block1-Insert1 @ X,Y,Z Rotate Scale Layer Color etc.
This seems to work on your drawing:Code - Auto/Visual Lisp: [Select]
) (vlax-for b bd ) ) ) )