I’m actually writing a wall tool that wrap a dynamic component placement, orientation and scaling. Everything works fine except that I’m unable to force the dynamic component to be refreshed/redrawn correctly
I found @DanRathbun post regarding the way to force a dynamic component to be redrawn.
That works perfectly for a single usage but doesn’t for subsequent use. When I add an another instance of my dynamic component that use the ScaleTool behaviour with my drawing tool I get the dynamic component instance redrawn using both previous and current scale factors.
Any idea of what append cause I’m unable to understand that code snippet and there’s no documentation regarding the dynamic components
: $dc_observers.get_latest_class.redraw_with_undo(inst)
Ok my mistake, I didn’t well understood how the dynamic component worked. I was using them like standard component, ie :
First iteration
Sourcing the component definitions in the model
Inserting a instance with its transform (with scale implying the definition to be updated).
Force a redraw.
Second iteration
The component was already sourced into the model so I was directly inserting an instance into my model with its transform with again a scale factor applied on a modified definition and leads to a new definition generated.
Thanks @pcmoor but the problem was that the second time I was computing a scale factor based on a definition that have been modified at the first iteration (as I didn’t noticed that scaling a dynamic component leads to updating the definition), so I wasn’t computing the right scale factor.
I’m now reinserting my base dynamic component at each use unless the requested length already have been drawn (then reuse the existing one)