TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Marc'Antonio Alessi on February 12, 2020, 05:10:48 AM
-
In my case all the blocks are not scaled > scale xyz = 1
I need to calculate the BoundingBox of dynamicblocks (INSERT) excluding certain layers, currently I am able to calculate the BoundingBox processing the information of the block definition (non-dynamic BLOCK) and excluding certain entities or layers and transforming the two points obtained for each inserted block (INSERT) with Matrix Transformation functions (thanks to Lee Mac, gile, Nesterovsky, Wilson, etc.).
This method does not work with dynamic blocks, very simple example:
- Dynamic block with two parameters: length and height
- rectangle on layer A (yellow)
- rectangle on layer B (red)
Question: how to calculate the BoundingBox considering only the entities on layer B (red)?
-
This (http://www.theswamp.org/index.php?topic=48405.msg534887#msg534887) should hopefully perform successfully with dynamic blocks - currently the function omits Text & Attributes when calculating the bounding box, but you could easily add additional filters to exclude/include specific objects based on their properties.
-
@Marc'Antonio Alessi:
Are you looking at the correct block definition (the 'normal' name def, not the effective name def)?
-
Look for BlockRef->VisStatesL, try searching just using VisStatesL. It returns a list of entities with each visibility state. You can then extract the entities you want for the bounding box. This works for individual references.
-
@Lee: Now surely I will watch your tip
@Roy: unfortunately I don't know well the topic dynamic blocks, these are some properties of the inserted block about EffectiveName and Name
(I have to calculate the BBox with the measures of the inserted block):
; EffectiveName (RO) = "Foo"
; HasAttributes (RO) = -1
; HasExtensionDictionary (RO) = -1
; InsUnitsFactor (RO) = 1.0
; IsDynamicBlock (RO) = -1
...
; Name = "*U232"
...
; XEffectiveScaleFactor = 1.0
; XScaleFactor = 1.0
; YEffectiveScaleFactor = 1.0
; YScaleFactor = 1.0
; ZEffectiveScaleFactor = 1.0
; ZScaleFactor = 1.0
@CincyJeff: I will have to learn more about DBlocks and VisStatesL
Thanks to all.
-
In your example you would need to check the "*U232" block definition.
-
In your example you would need to check the "*U232" block definition.
Ok tomorrow I will try, thanks again. :-)
-
In your example you would need to check the "*U232" block definition.
I have not resisted to try, even if here in Italy it is a little late... everything seems ok for the blocks with linear parameter :-) :-) :-),
for the visibility parameters it is not correct but for the moment I think it will be enough for me.
Good night. 8-)
-
I have not resisted to try, even if here in Italy it is a little late... everything seems ok for the blocks with linear parameter :-) :-) :-),
for the visibility parameters it is not correct but for the moment I think it will be enough for me.
Good night. 8-)
If you have multiple visibility states, you have to filter out the invisible objects.
The objects from other vis_states are just turned invisible when you switch between states.
When you step inside block definition, simple chek
-
I have not resisted to try, even if here in Italy it is a little late... everything seems ok for the blocks with linear parameter :-) :-) :-),
for the visibility parameters it is not correct but for the moment I think it will be enough for me.
Good night. 8-)
If you have multiple visibility states, you have to filter out the invisible objects.
The objects from other vis_states are just turned invisible when you switch between states.
When you step inside block definition, simple chek
ok it seems like a simple solution i will try immediately, thanks. :-)
Edit: tested > all is OK > grazie mille anche a Lee Mac. :wink: