haplokuon / netDxf

.net dxf Reader-Writer
MIT License
966 stars 392 forks source link

netdxf retrieves a differente name for Dynamic blocks! #454

Closed MiguelG97 closed 1 year ago

MiguelG97 commented 1 year ago

Hi folks,

I have a dynamic block which name is "Dynamic Door Right" image

however, netDxf displays it as "U14". How can I map my blocks by names when using dynamic blocks? image

best regards

DavidWishengrad commented 1 year ago

I am not very good at helping here. I just don't know enough. I know we all should be reading the examples and comments of the author.

I think your issue is that the data is encrypted. You can check for the name text string in your dxf if you save it as ascii.

If you can add xdata in your source cad app to your block, then you can probably find it later if nothing else pans out. I realize this may not be possible depending on the source app.

I am feeling good that opening and saving the dynamic blocks with netDXF does not destroy them. I have only identified objects as a block "insert" and moved them. Good luck. You will probably get a much better, sorter, and concise answer from someone else.

If you can add xdata, then you can add it to the objects in the block and the block itself and you can also use the obscure dxf codes for world position and orientation. When the object is moved and rotated by the end user the values will change. An object copied will also have the same xdata. Undo will also work. Best of all, if you pull the current matrix values that you assigned in those dxf codes and multiply the matrix against itself, the resulting matrix is the transformation matrix, and that if you were to overwrite the current object matrix with it, the object will be transformed (rotated) and translated (moved) back to exactly as it was when the matrix was originally added. Using 1,0,0 0,1,0 0,0,1 as a stamp when it is oriented how you might want to bounding box it, and then doing it will shed some more light. It's good place to start if you really need the sizes of things too.

haplokuon commented 1 year ago

Come on people don`t be lazy and use the search function, it is not there just for show it is actually useful. If you try to search for "dynamic blocks" you will find a discussion that will answer your question, but this time I am not going to do it for you.

MiguelG97 commented 1 year ago

my bad, didnt thought the topics would've be related to dynamic blocks since the titles refers to other troubles

Thanks for the reference both of you @DavidWishengrad , though

best regards