Assembly custom property linked to part configuration
-
- Posts: 51
- Joined: Wed Mar 01, 2023 6:55 pm
- x 36
- x 5
Assembly custom property linked to part configuration
The way we address "paint" in our assemblies (mainly for EPR and BOM purposes) is to have a "dummy" part called ZPAINT in all assemblies. This dummy part has many configuration indicating the paint or powder coat process, the colour and the texture. I want the a custom property called "Finish" in the assembly to be linked to the configuration specific property of the ZPAINT part.
So, when you model up the Assembly, you include the ZPAINT part with the configuration that match the colour, texture etc what you want. This will update the Custom property call "Finish" of the final assembly. This property is then used in the drawing for the assembly.
So, when you model up the Assembly, you include the ZPAINT part with the configuration that match the colour, texture etc what you want. This will update the Custom property call "Finish" of the final assembly. This property is then used in the drawing for the assembly.
You can write all the code in the VBA editor and then paste it to the property once it's working. There are just a couple of tweaks between the two that you can work out from the example you have.
The example also iterates through all the components of the assembly. You just need to iterate until you find your ZPAINT component.
Reading custom properties is basically the same as writing them when using CustomInfo2.
Go to full postThe example also iterates through all the components of the assembly. You just need to iterate until you find your ZPAINT component.
Reading custom properties is basically the same as writing them when using CustomInfo2.
Re: Assembly custom property linked to part configuration
This is not doable without a macro. And even with the macro, it won't be dynamic. Maybe a macro feature could be utilized to keep it dynamic.
Deepak Gupta
SOLIDWORKS Consultant/Blogger
SOLIDWORKS Consultant/Blogger
-
- Posts: 51
- Joined: Wed Mar 01, 2023 6:55 pm
- x 36
- x 5
Re: Assembly custom property linked to part configuration
Thanks, I will do it manually then
Re: Assembly custom property linked to part configuration
Completely hack and maybe not acceptable in your use, but... I assume the "paint" part model has no bodies in it?
Does your assembly have a BOM? Would it be acceptable to show the finish in the BOM? Perhaps part number: "Finish" and description would be color, texture, etc.
Secondly, if the ZPAINT model had a little paint can body in it, or some kind of a finish/paint icon. Then in the assembly drawing show it in one of the views (it will likely be an in the way PITA in the other views) then add a note with leader attached to it with $PRP... to get the custom property to show on drawing.
If I understand what you're trying to accomplish, this should force the assembly model to be using the correct configuration of the ZPAINT model to get it to show correctly on the drawing. If you have PDM this would also allow you to do a where used on the specific config of the ZPAINT to find all assemblies with that finish.
Does your assembly have a BOM? Would it be acceptable to show the finish in the BOM? Perhaps part number: "Finish" and description would be color, texture, etc.
Secondly, if the ZPAINT model had a little paint can body in it, or some kind of a finish/paint icon. Then in the assembly drawing show it in one of the views (it will likely be an in the way PITA in the other views) then add a note with leader attached to it with $PRP... to get the custom property to show on drawing.
If I understand what you're trying to accomplish, this should force the assembly model to be using the correct configuration of the ZPAINT model to get it to show correctly on the drawing. If you have PDM this would also allow you to do a where used on the specific config of the ZPAINT to find all assemblies with that finish.
Re: Assembly custom property linked to part configuration
You could have a hidden view of ZPAINT in the assembly drawing and link the drawing to the ZPAINT finish property directly, instead of going through the assembly model.Jacomuller wrote: ↑Thu Oct 05, 2023 6:25 pm This property is then used in the drawing for the assembly.
Dwight
-
- Posts: 51
- Joined: Wed Mar 01, 2023 6:55 pm
- x 36
- x 5
Re: Assembly custom property linked to part configuration
@Dwight . Thanks for the feedback. I would prefer to have the data in the Assembly's custom properties as I am using another macro to populated data for the ERP from the Assembly's custom properties. @bnemec The "ZPaint" part is actually a spray gun that is visible in BOM drawing. In the BOM, the ZPAINT's part number is the paint code (including texture, colour etc. ) and the description lists the colour, texture etc. We do use PDM and ZPAINT is setup as a generic part.
Re: Assembly custom property linked to part configuration
Well.... Since the subject has already been broached in your other thread... you could hide code in a custom property and execute it with an equation to find the ZPAINT component and copy its property value to the assembly.
-
- Posts: 51
- Joined: Wed Mar 01, 2023 6:55 pm
- x 36
- x 5
Re: Assembly custom property linked to part configuration
Yip, will have a new look at it with that in mind, thanks.
-
- Posts: 51
- Joined: Wed Mar 01, 2023 6:55 pm
- x 36
- x 5
Re: Assembly custom property linked to part configuration
Hi @josh , I have tried to use the same technique as what you have done, but I am struggling. If it was in the VB editor, it would have been a bit easier (Since I don't code that often ) but doing in the custom properties field is challenging.
In essence, what I want to do is the following (written in normal words, not in commands yet.):
I will create three custom Properties "Code", "PaintCode" and "PaintDescription" in the Assembly and give Values of "1" to each.
I will then Create a Global Variable "PaintInfo" and link it to "Code". I will then paste the following code in the custom property "Code"
Dim vComps As Variant
Dim Assy_Paint_Code as String
Dim Assy_Paint_Description as String
IF (“ZPAINT” a part of the assembly) = “No” then
Assy_Paint_Code = “N/A”
Assy_Paint_Description = “N/A”
ELSE
Assy_Paint_Code = ZPAINT custom property “PartNo” Value
Assy_Paint_Description = ZPAINT custom property “Description” Value
END IF
Assembly.CustomInfo2("", "PaintCode") = Assy_Paint_Code
Assembly.CustomInfo2("", "PaintDescription") = Assy_Paint_Description
The Red bits, are the parts I don't know
In essence, what I want to do is the following (written in normal words, not in commands yet.):
I will create three custom Properties "Code", "PaintCode" and "PaintDescription" in the Assembly and give Values of "1" to each.
I will then Create a Global Variable "PaintInfo" and link it to "Code". I will then paste the following code in the custom property "Code"
Dim vComps As Variant
Dim Assy_Paint_Code as String
Dim Assy_Paint_Description as String
IF (“ZPAINT” a part of the assembly) = “No” then
Assy_Paint_Code = “N/A”
Assy_Paint_Description = “N/A”
ELSE
Assy_Paint_Code = ZPAINT custom property “PartNo” Value
Assy_Paint_Description = ZPAINT custom property “Description” Value
END IF
Assembly.CustomInfo2("", "PaintCode") = Assy_Paint_Code
Assembly.CustomInfo2("", "PaintDescription") = Assy_Paint_Description
The Red bits, are the parts I don't know
Re: Assembly custom property linked to part configuration
You can write all the code in the VBA editor and then paste it to the property once it's working. There are just a couple of tweaks between the two that you can work out from the example you have.
The example also iterates through all the components of the assembly. You just need to iterate until you find your ZPAINT component.
Reading custom properties is basically the same as writing them when using CustomInfo2.
The example also iterates through all the components of the assembly. You just need to iterate until you find your ZPAINT component.
Reading custom properties is basically the same as writing them when using CustomInfo2.