Assembly custom property linked to part configuration

Use this space to ask how to do whatever you're trying to use SolidWorks to do.
Jacomuller
Posts: 47
Joined: Wed Mar 01, 2023 6:55 pm
Answers: 2
x 33
x 4

Assembly custom property linked to part configuration

Unread post 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.
by josh » Tue Oct 17, 2023 8:26 am
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 post
User avatar
gupta9665
Posts: 412
Joined: Thu Mar 11, 2021 10:20 am
Answers: 25
Location: India
x 434
x 450

Re: Assembly custom property linked to part configuration

Unread post 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.
Deepak Gupta
SOLIDWORKS Consultant/Blogger
Jacomuller
Posts: 47
Joined: Wed Mar 01, 2023 6:55 pm
Answers: 2
x 33
x 4

Re: Assembly custom property linked to part configuration

Unread post by Jacomuller »

Thanks, I will do it manually then :(
User avatar
bnemec
Posts: 1944
Joined: Tue Mar 09, 2021 9:22 am
Answers: 10
Location: Wisconsin USA
x 2548
x 1400

Re: Assembly custom property linked to part configuration

Unread post 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.
User avatar
Dwight
Posts: 274
Joined: Thu Mar 18, 2021 7:02 am
Answers: 2
x 2
x 220

Re: Assembly custom property linked to part configuration

Unread post 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
User avatar
bnemec
Posts: 1944
Joined: Tue Mar 09, 2021 9:22 am
Answers: 10
Location: Wisconsin USA
x 2548
x 1400

Re: Assembly custom property linked to part configuration

Unread post 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.
Jacomuller
Posts: 47
Joined: Wed Mar 01, 2023 6:55 pm
Answers: 2
x 33
x 4

Re: Assembly custom property linked to part configuration

Unread post 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.
User avatar
josh
Posts: 295
Joined: Thu Mar 11, 2021 1:05 pm
Answers: 16
x 22
x 508

Re: Assembly custom property linked to part configuration

Unread post 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.
Jacomuller
Posts: 47
Joined: Wed Mar 01, 2023 6:55 pm
Answers: 2
x 33
x 4

Re: Assembly custom property linked to part configuration

Unread post by Jacomuller »

Yip, will have a new look at it with that in mind, thanks.
Jacomuller
Posts: 47
Joined: Wed Mar 01, 2023 6:55 pm
Answers: 2
x 33
x 4

Re: Assembly custom property linked to part configuration

Unread post 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 :D ) 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 :?:
User avatar
josh
Posts: 295
Joined: Thu Mar 11, 2021 1:05 pm
Answers: 16
x 22
x 508

Re: Assembly custom property linked to part configuration

Unread post 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.
Post Reply