Dynamic block is not fully supported
khoa.ho
2/17/2012 9:33 PM
|
Hi,
At this time, I know that CadLib does not support dynamic blocks. But I really want CadLib to import all dynamic block parameters and actions to somewhere in the DxfBlock class. I see dynamic block is currently read in DxfModel.AnonymousBlocks collection, and exposed some properties in ExtendedDataCollection. But I don't see where to get some dynamic block parameters and actions such as AcDbBlockAlignmentParameter, AcDbBlockAlignmentGripEntity, AcDbBlockMoveAction,... Those properties are also found at DxfModel.Classes of a model that contains dynamic blocks.
I need dynamic blocks to fully imported to ExtendedDataCollection or UnsupportedObjetcs to read its parameters and actions in order to code for transforming its nested entities.
Thank you in advance,
Khoa
|
rammi
2/28/2012 4:22 PM
|
I must confess that I haven't worked with dynamic blocks yet. The DXF spec is not very helpful (it does not mentioned dynamic blocks at all), so at the moment I don't know how dynamic blocks are embedded in the file.
Can you share some examples?
If yes you may send them via my profile. Of course all customer files are handled with utmost care.
Thanks,
Rammi
|
khoa.ho
3/14/2012 5:21 PM
|
Hi Rammi,
Thank you for your reply. I am sorry for the late response as I did not see this reply sending to my email. There are couple of dynamic block examples under folder Sample\Dynamic Blocks of AutoCAD installation directory. Anyway, I make an example with my dynamic block drawing in both DWG and DXF files, and see that the DXF file (from version 2000 and above) still can display dynamic blocks. Please check out the attached files and see the following snapshots:
On AutoCAD model space:
On AutoCAD Block Editor (right click on the block and select Block Editor):
There are some parameters of this dynamic block: Flip, Move, Stretch. I pick the Stretch parameter and search for its info in the DXF file and see that there are many places in DXF file that have Stretch string, such as:
BLOCKSTRETCHACTION
AcDbBlockStretchAction
STRETCHACTIONENTITY
AcDbBlockStretchActionEntity
Because those info of block dynamics are stored in DXF file, AutoCAD can display dynamic blocks in DXF file. The problem is CadLib reads a dynamic block into DxfModel.AnonymousBlocks dictionary, and then expose some dynamic block properties in thisBlock.ExtendedDataCollection and thisBlock.ExtensionDictionary.Entries. But that is not enough to present a dynamic block. There are no properties for dynamic block parameters and actions.
It would be superb if CadLib fully read all info of the dynamic block, because DXF is fully supported dynamic blocks.
My idea is CadLib may have two new classes: DxfDynamicBlock and DxfDynamicInsert
- DxfDynamicBlock stores all info of the dynamic block, such as parameters (point, linear, rotation,...), actions (move, scale, stretch,...) that link to parameters and entities (DxfEntity). DxfDynamicBlock is a property of DxfBlock. This property will be null if this DxfBlock is not a dynamic block.
- DxfDynamicInsert stores all real custom properties of a DxfInsert instance of a DxfBlock reference. Therefore DxfDynamicInsert will be a property of DxfInsert to display how a dynamic block shows in AutoCAD.
I am willing to implement some parts of the new dynamic block feature if you need. CadLib is a great product and we are happy to have CadLib for our AutoCAD automation.
-Khoa
|
khoa.ho
3/14/2012 8:54 PM
|
I have some suggestions for implementing the new dynamic block feature. There may be some new classes and properties:
--- Current classes with new added properties:
DxfBlock class:
Property Name |
Property Type |
DynamicBlock |
DxfDynamicBlock |
DxfInsert class:
Property Name |
Property Type |
DynamicInsert |
DxfDynamicInsert |
--- New suggested classes:
DxfDynamicBlock class:
Property Name |
Property Type |
Parameters |
DxfDynamicBlockParameterCollection |
Actions |
DxfDynamicBlockActionCollection |
DxfDynamicInsert class:
Property Name |
Property Type |
DynamicProperties |
DxfDynamicBlockPropertyCollection |
---Dynamic block parameters
DxfDynamicBlockParameter class:
Property Name |
Property Type |
IsPropertyShowed |
boolean |
IsActionChained |
boolean |
GripCount |
int |
DxfDynamicBlockParameter inheritance:
Derived Classes |
DxfDynamicBlockParameterAlignment |
DxfDynamicBlockParameterBasePoint |
DxfDynamicBlockParameterLinear |
DxfDynamicBlockParameterLookup |
DxfDynamicBlockParameterFlip |
DxfDynamicBlockParameterPoint |
DxfDynamicBlockParameterPolar |
DxfDynamicBlockParameterRotation |
DxfDynamicBlockParameterVisibility |
DxfDynamicBlockParameterXY |
|
One example of dynamic block parameter classes:
DxfDynamicBlockParameterAlignment class:
Property Name |
Property Type |
AlignmentType |
DynamicBlockParameterAlignmentType |
DynamicBlockParameterAlignmentType enum:
Member Name |
Perpendicular |
Tangent |
---Dynamic block actions
DxfDynamicBlockAction class:
Property Name |
Property Type |
Type |
DynamicBlockActionType |
Name |
string |
SelectionSet |
DxfEntityCollection |
DynamicBlockActionType enum:
Member Name |
Array |
Flip |
Lookup |
Move |
Scale |
Stretch |
Polar |
Rotate |
---Dynamic block properties
DxfDynamicBlockProperty class:
Property Name |
Property Type |
PositionX |
double |
PositionY |
double |
FlipState |
DynamicBlockPropertyFlipState |
... |
... |
DynamicBlockPropertyFlipState enum:
Member Name |
Flipped |
NotFlipped |
---
I am willing to cooperate to implement dynamic blocks in CadLib. From the DXF Reference link of Autodesk ( http://usa.autodesk.com/adsk/servlet/item?siteID=123112&id=12272454&linkID=10809853), I also surprise that Autodesk does not publicly document dynamic block. Anyway, by learning the content of a DXF file with dynamic blocks, we will know the group codes and variables of the dynamic block.
Regards,
Khoa
|
Wout
3/19/2012 11:01 AM
|
Hi,
Thank you for your kind offer, but we can handle the implementation. You could be of help with testing though, I will keep you informed.
- Wout
|
khoa.ho
3/21/2012 4:47 PM
|
Thank you Wout. I definitely will do testing for the new dynamic block feature on requests. This will be very interesting that CadLib can handle almost AutoCAD entities.
Best regards,
Khoa
|
khoa.ho
2/28/2013 3:23 PM
|
Hi Wout,
Do you have plan to implement dynamic block in the future releases? I wish CadLib to support dynamic blocks.
Thanks,
Khoa
|
larsD
7/22/2013 6:43 AM
|
Hi,
at the moment, I'm also searching for a CAD library that supports dynamic blocks. I've asked for them in this forum in 2010 and I am still interested in any news about this feature request.
Thanks,
Lars
|
Wout
7/23/2013 1:30 PM
|
Hi,
At the moment only read/write are supported, but not the evaluation of the constraints. That would be a large investment, and at the moment there are only a few users interested in it (about 2-3), so as it stands now it's not enough to justify starting implementation.
- Wout
|
larsD
7/24/2013 9:50 AM
|
Hi Wout,
thanks for your answer. I understand your reasons not to implement dynamic blocks fully at the moment.
But, could you elaborate what you mean by "read/write are supported". Maybe that's just fine for us and we don't need more.
Important for us is the read EVERY dynamic block's insertion point and user-defined attribute from the CAD file. So far, our own implementation has severe problems with dynamic/anonymous blocks and always misses to extract some of them.
Thanks,
Lars
|
|