Page 1 of 1
Assembly custom property linked to part configuration
Posted: Thu Oct 05, 2023 6:25 pm
by Jacomuller
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.
Re: Assembly custom property linked to part configuration
Posted: Fri Oct 06, 2023 1:25 am
by gupta9665
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.
Re: Assembly custom property linked to part configuration
Posted: Sun Oct 08, 2023 6:53 pm
by Jacomuller
Thanks, I will do it manually then
Re: Assembly custom property linked to part configuration
Posted: Mon Oct 09, 2023 10:03 am
by bnemec
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.
Re: Assembly custom property linked to part configuration
Posted: Mon Oct 09, 2023 3:26 pm
by Dwight
Jacomuller wrote: ↑Thu Oct 05, 2023 6:25 pm
This property is then used in the drawing for the assembly.
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.
Dwight
Re: Assembly custom property linked to part configuration
Posted: Mon Oct 09, 2023 4:00 pm
by bnemec
Dwight wrote: ↑Mon Oct 09, 2023 3:26 pm
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.
Dwight
This would work well if you don't use PDM.
Re: Assembly custom property linked to part configuration
Posted: Mon Oct 09, 2023 4:40 pm
by Jacomuller
@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
Posted: Wed Oct 11, 2023 7:45 pm
by josh
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.
Re: Assembly custom property linked to part configuration
Posted: Wed Oct 11, 2023 9:13 pm
by Jacomuller
Yip, will have a new look at it with that in mind, thanks.
Re: Assembly custom property linked to part configuration
Posted: Mon Oct 16, 2023 10:01 pm
by Jacomuller
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
Re: Assembly custom property linked to part configuration
Posted: Tue Oct 17, 2023 8:26 am
by josh
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.