p7q Posted 23 hours ago Posted 23 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 14 hours ago Posted 14 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 14 hours ago by BIGAL 2 Quote
p7q Posted 5 hours ago Author Posted 5 hours 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 4 hours ago by p7q Quote
Lee Mac Posted 1 hour ago Posted 1 hour ago Based on the title of your thread, here's an existing program to match dynamic block properties: https://www.theswamp.org/index.php?topic=44444.msg496892#msg496892 Where mirroring text in blocks is concerned, here's some food for thought: https://www.theswamp.org/index.php?topic=46271.msg513250#msg513250 1 Quote
p7q Posted 1 hour ago Author Posted 1 hour ago 5 minutes ago, Lee Mac said: Based on the title of your thread, here's an existing program to match dynamic block properties: https://www.theswamp.org/index.php?topic=44444.msg496892#msg496892 Where mirroring text in blocks is concerned, here's some food for thought: https://www.theswamp.org/index.php?topic=46271.msg513250#msg513250 Thanks for the links. @Lee Mac They’re helpful, but my main problem is already-mirrored block references that I receive from others. I’m looking for an AutoLISP routine/approach to fix text inside existing mirrored blocks, not to control how blocks are mirrored in the first place. Do you have any code or examples that could help with this specific case? 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.