Update DC and preserve attributes

dynamiccomponents

#1

Hi all,

I’m working on a woodworking project. I have created a bunch of roughed up mockup components for a few things, such as furniture legs, boards, etc, with custom attributes and behaviour for scaling.

In the libarary model, I right-clicked the component used save as and saved it into a components folder.

In the actual product model I used the components view to open the local collection pointiing to the components folder, and placed a bunch of them into the model, 4 furniture legs, a bunch of boards, etc,
scaled them accordingly, and specified the custom attributes.

Now I would like to make the legs a bit nicer, and add a few extra options, but it seems like whenever I replace the DC either using rightlick -> replace, or righclick -> dynamic components -> swap, I get a warning that the component has been edited. But it hasn’t, although the attributes have been modified using the component options view.
If I carry out the reload / swap, all the attributes are forgotten, and the values from the component are loaded.
Is there a way to avoid this?

This is my first post, I’m happy to share the model, so you can take a look at it, but not sure how to do that.


#2

Drag and drop in the forums reply area (when you edit or reply), or use the 7th icon from left:


#3

You can ‘double wrap’ your DC by making a new component within. By refering to ‘Parent’ attributes and keeping the Options to choose on the highest level Component, the values will be kept.
This will need some preparation/altering your components etc.


#4

Hello. I believe I did that correctly, but please check:

This is where I develop the component


#5

and this is the exported one using right click save as


#6

Sorry for cutting up my reply, it seems i’m only allowed one attachment per message.


#7

The one you “save as” should have
=current(“lenx”)*2.54 in value box of lenx attribute. The 2.54 is just for inch conversion, not needed for those in the USA
like wise for the other sizes
=current(“leny”)*2.54
=current(“lenz”)*2.54
Then the values will be matched to the one swapped, Do not worry about overwriting these formulas whilst working in the model, so long as the saved component has them


#8

Not sure what you mean, because that seems like a circular dependency, and sketchup does complain becuase of that too:


#9

This is what I wrote: 11


#10

you are on a mac, try without the quotes, don’t forget the *2.54 to change to cms


#11

Like 90% of the population I am using cms by default :wink:, but your suggestion is introducing a circular reference:


#12

Any ideas why my messages are being marked as spam?..


#13

Hello pcmoor, I may be having a similar issue as the OP. I have two DCs that have a “Left” or “Right” attribute saved to my component library with the direction set to “Right”. If one is set to “Left” in the model and I try to reload it with one from the library the direction flips. So, now “Right” has become “Left” and vice versa. Is there a way to have reloaded components take up the attributes of the one they are replacing?Dynamic Component Saved Scene.skp (316.2 KB)


#14

You’ll need to wrap the components in a Higherlevel wrapper component were you direct all the varables.

and the file:
Dynamic Component Saved Scene.skp (2.6 MB)


#15

Maybe this is the problem?..

on windows
=current(“lenx”)*2.54 works
0.0 not found error is not same as circular reference. Likely the " " is not recognized, they may be smart quotes on your machine


#16

maybe a purge? 2.6 MB


#17

Yeah, it was those annoying smart quotes. Thanks, turning them off seems to have fixed the issue with the errors, however the replaced components are losing their attributes again now…

I’ll try @MikeWayzovski’s suggestion a bit later today, although I’m not 100% on what he is suggesting. It seems to me that I do have this wrapper component already, but I’ll to wrap it again.


#18

Okay, so the solution seems to be to NOT use the LenX, LenY and LenZ in the outermost component (the one exported) as inputs. If I create three other custom attributes, say SizeX, SizeY, and SizeZ, and then use the formulas =SizeX, =SizeY and =SizeZ for the LenX, LenY, and LenZ respectively, then it works nicely after using rightclick -> dynamic components -> swap, but not the right-click, reload.


#19

Hi, Thank you for the reply. I think I finally understand “Wrapping” of components. Now I have to go redo all or most of my DCs. :persevere: Thanks again for the help!

Jeff


#20

Hi Mike,

I thought I had it figured out, but there is still an issue. When I change the Height attribute in the model you posted the Axis does not follow the DC. I need the height parameter to be relative to the drawing origin. In other words, if I set the height to be 700 mm it needs to be 700 mm up from the drawing origin. If I set a height in the dialog, say 500 mm, and then move it with the “Move” tool the dialog remains at 500 mm instead of showing the new height of the DC. :thinking:

Thanks,
Jeff