Hello!
I am currently working on a dynamic 2D block (a tree) and having some trouble with the parameters.
After spending hours on YouTube and Google I still haven't figured out how the parameters (and expressions) work.
Below is a screenshot of my block showing the properties pane and the parameter manager.
I tried changing the expressions, but AutoCAD throws an error, no matter how and where I change the expression.
I'm totally upset and really need some help.
The final block should look somewhat like on the screenshot below.
Unfortunately this setup doesn't work properly. The outer ring of the tree moves out of the center point, etc.
This are two requirements of the final block and I would highly appreciate it if someone could help with the creation.
Now something on the topic:
How do the parameter expressions work? Where can I enter a formula?
No matter what I do, AutoCAD tells me that the expression is wrong (see screenshot above).
If you need any more information or screenshots, please let me know.
Solved! Go to Solution.
Solved by Libbya. Go to Solution.
Expressions/formulas do not work with action parameters. They will work with constraints, but for such a simple block I would not recommend using constraints.
Can you post the block? Is there a relationship between the size of the trunk and the size of the crown that needs to be maintained by a formula? If so, what is that relationship?
Hello @Libbya !
Yes, that is exactly what I am trying to do.
I created a new tree block from scratch, but it still doesn't work.
The problem is that the crown (Polyline) and the trunk (Circle) don't stay centered when I resize them (see ScreenCast).
Do you have an idea why that happens?
ScreenCast: https://knowledge.autodesk.com/community/screencast/82c9ca3c-c617-4e86-9d2d-70531ba96794
It is best to post your block with your inquiry. Probably you either didn't switch the parameter base points to midpoint or you didn't set the scale actions property base to independent and set the grip at the center of the circle. If you need further assistance post your block.
Okay, thanks @Libbya
Still having problems so I attached the drawing file.
Would be so glad if you could take a look at it.
Even though the parameter base is set to midpoint, you still need to set the scale action base property to independent and move the new base grip to that same midpoint location. See screencast.
@Libbya Many thanks for your time and solution. I finally made it work.
I've got one more question:
Is it possible to control the parameters with a command or script?
Let's say I've got a nice little forest over here with about 500 trees where each one is different in size.
I think you see where this is going: I would have to adjust 500 blocks manually (crown and trunk size) and that is really nasty.
Let's assume I have an ASCII coordinate file that looks like this:
Point_Number X-Coordinate Y-Coordinate Z-Coordinate Trunk_Diameter Crown_Diameter
Is there any way to automate the process? Maybe with block attributes?
Although I have read in the forums that it is currently not possible to adjust a parameter from an attribute value.
Anyway, any help appreciated.
It does seem that we can reference attribute fields in an instance of a block, but not in the the block definition. So you would need to define the block, then set up formulae, then copy the block 500 times (instead of inserting new block instances). I'm not saying this is a solution, just possibly something to help understand the blocks.
Maybe... if a block w/ attributes was nested in another block, a formula referencing an attribute (in the inside block instance) could be built into the definition of the block containing it? I don't know what happens to attributes in nested blocks; maybe someone here can tell us or figure it out.