60001650 Dynamic Blocks of acad implementation

Article 60001650
Type Wish
Product Engine
Version 6021
Date Added 3/20/2012 12:00:00 AM
Fixed (6/26/2012 12:00:00 AM)
Submitted by Tchouakeu Fongue

Summary

It is possible to add the ability to read the properties and values of blocks and block references of ACAD ? We carry out a lot of automated process and one is the ability to swap these new static blocks prefixed ANONYMOUS_ with other blocks prepared for this eventuality. The only problem being that I cannot locate the Dynamic Properties of the blocks which are the parameters needed to configure the swapping criteria. It will be great if the file Import/Open process can raise some events (i.e. OnDynamicBlockFound()) to enable interaction with the process. This would leave all options to the developer to do what he wants with the object. Hope you could provide one of the event during the Import/Open process or a list of the Dynamic properties after the file is in Vector Draw. Hello Peter, Thanks for your quick reply and willingness to help. I’ve attached a sample drawing which includes dynamic blocks from 2 different clients just to illustrate the fact that the custom properties we seek to collect are not of a fixed name with the exception been the Visibility and Flip state, we cannot really tell what they will be beforehand. To reduce our previous Application reliance on AutoCAD, I implemented a little utility tool to convert AutoCAD drawings into a flat XML file. This tool allows users to set the criteria to use to naming the dynamic block when converted to static and have a meaningful name with an entry in our application’s library which was then picked up automatically and replaced by another custom blocks. And the same criteria was used for each block instance to configure the dynamic block reference in AutoCAD when the drawing was exported out of our system to DWG. I’ve included the tool for you to see what I am talking about. The tool developed for AutoCAD 2009 was used to convert a DWG drawing into a XML document converting dynamic blocks to static one building the derived static block name based on the specified criteria. Do the following to test the utility tool on the accompanied drawing in AutoCAD 2009: - Open the drawing in AutoCAD 2009 (hope you have a copy installed) - Type “netload” on the command line and upload the file APUKObjectARX2009-V3.dll - Type “apexport” in the command line to load the GUI - Select an item in the list of dynamic blocks returned to list its properties below and the select a property in the left panel move it the right panel in the order you want . do this for all of them - Uncheck the option “Rollback changes made during operation” at the bottom left of the window and press GO - A XML file of the drawing will be created at the same location of the drawing. But you can also check the result in the still opened drawing by selecting a block reference to check out its new name which is its derived dynamic block name followed by the value of the selected custom properties in the specified order: that’s exactly what we want to achieve in order to electronically recognize and process those blocks. So providing a list of the custom properties as a XCustomData property on each block reference or raising an event for each dynamic block reference found during the Import/Open will be just too good. So the developer can do what they want with it after the DWG is open in VectorDraw. I’ll go with the first option which I guest will only require an extra property from you and will not potentially slowdown the import process that much as compare to the current code. So below are what I’m suggesting: - Option 1: a property on vdFigures.vdInsert of type collection bearing the pair values of the custom properties - Option 2: an event on vdObjects.vdDocument raised at each dynamic block reference found during the Import/Open process. The event could return the block reference before conversion and its static name to be i.e. ANONYM_1234. you do understand that I approach this obviously from my sole position as it will suit me. You may come out with a better solution based on how you see it fit and I’ll still be delighted. As long as one can retrieve the custom properties list per block reference, it’ll be really appreciated. Dynamic blocks are coming and look to be here to stay. It’s like a little rock in the shoe at the moment when working with cross platforms but I’m sure it’ll be domed put to rest very soon. Many thanks for reading; SEE ATTACHMENT -->

Solution

In the 6023 version a new value ReadDynamicBlockProperties is available in FilePropertie's ImportDWGFlags properties. By default this value is AnalyzePolylineCurves so you need this to be changed in your application to AnalyzePolylineCurves + ReadDynamicBlockProperties. If this value is specified then the extra properties of dynamic blocks references are read and added as XProperties in the object.

These are added in tetrads with VALUE/SHOW/READONLY/DESCRIPTION for each dynamic property of this block.
For example a dynamic block/blockRef with a property with the name "Origin" can be read in the XProprties of the vdInsert like:

  • DYN_BLOCK_Origin_VALUE : contains the value of the property Origin
  • DYN_BLOCK_Origin_SHOW : visible or not
  • DYN_BLOCK_Origin_READONLY : read only or not
  • DYN_BLOCK_Origin_DESCRIPTION : the description (text) of this property if exists

Send comments on this topic.