p7q Posted 19 hours ago Posted 19 hours ago I’m trying to work with Dynamic Blocks in AutoLISP. Question: Is it possible to read a Dynamic Block’s properties/parameters (for example visibility states, dynamic distances, flips, etc.) and then copy or apply those values to another block reference using plain AutoLISP/VLISP? If this is possible, what functions or example code should I look at? Thanksss. Quote
BIGAL Posted 10 hours ago Posted 10 hours ago (edited) Yes ! Your first step is get a copy of lee-mac dynamic block properties.lsp. I like others have used his code with great success. You may need to get all property names first, so you can then get in turn that property value, eg "Distance1", the current visibility state is much easier to get. If you get stuck just post again. https://www.lee-mac.com/dynamicblockfunctions.html Edited 10 hours ago by BIGAL 1 Quote
p7q Posted 1 hour ago Author Posted 1 hour ago (edited) 9 hours ago, BIGAL said: Yes ! Your first step is get a copy of lee-mac dynamic block properties.lsp. I like others have used his code with great success. You may need to get all property names first, so you can then get in turn that property value, eg "Distance1", the current visibility state is much easier to get. If you get stuck just post again. https://www.lee-mac.com/dynamicblockfunctions.html It's so usefull. Thanks @BIGAL for the help on reading/copying dynamic block properties – the approach you suggested for dynamic blocks seems to work quite well in my tests, and it looks like I can keep the dynamic behavior while transferring the values to another block reference. To clarify my actual use-case a bit more (it wasn’t very clear in my original question): What I’m really trying to solve is the situation where a block reference is mirrored, and the text inside that block (TEXT/MTEXT/etc.) becomes mirrored/unreadable. My goal is to “fix” the mirrored text so that it reads normally again, while still keeping the block as a block reference. Right now my algorithm roughly does this: Find mirrored block references (negative X/Y scale). Explode that mirrored block reference. From the resulting entities, create a new block definition. Insert this new block back with adjusted scale/rotation, so that the text appears non-mirrored/readable. This works reasonably well in some limited cases: Non-dynamic blocks Simple blocks without deep nesting But there are some important drawbacks: For dynamic blocks, exploding/rebuilding is not acceptable because I lose all the dynamic behavior (this is why your dynamic-block-based suggestion is very useful there). For blocks with attributes, the whole “explode + rebuild” idea is basically wrong for my use-case: With MIRRTEXT = 0, the attribute text itself is already displayed correctly (not mirrored) in a mirrored block reference, but other TEXT/MTEXT objects inside the same block are still mirrored. If I explode and rebuild that block, I’m just introducing more risk of breaking the attributes, even though they were already visually correct. For nested blocks, doing this recursively at multiple levels becomes very complex and potentially slow. In general, the “explode → rebuild block → insert new block” pattern feels too heavy and fragile if I want to handle all combinations (dynamic, attributes, nesting, etc.). It quickly turns into a very complicated algorithm that I’m not sure is worth the performance and maintenance cost. So my question now is more about design/approach: Is there a better/cleaner way (algorithm or pattern) to fix mirrored TEXT/MTEXT (and similar objects) inside mirrored block references, without relying on a full explode + re-create cycle, and that can coexist more gracefully with dynamic blocks, attributes (which are already correctly oriented with MIRRTEXT=0), and nested blocks? I’m not necessarily asking for full code, more for ideas on how you would approach this problem at a higher level. Any suggestions on a different strategy would be appreciated. Edited 44 minutes ago by p7q Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.