Custom Property to part
Custom Property to part
(OP)
Hello world,
I know it's easy enough to specify a material in Custom Properties by linking to the part material but does anyone know if it's possible to link the otherway round. In other words can you make the part material dependent upon the material specified in the custom properties. I have the 'Propagator' program that allows me to batch change the material in custom properties but not the material property within the part.
Thanks.
I know it's easy enough to specify a material in Custom Properties by linking to the part material but does anyone know if it's possible to link the otherway round. In other words can you make the part material dependent upon the material specified in the custom properties. I have the 'Propagator' program that allows me to batch change the material in custom properties but not the material property within the part.
Thanks.






RE: Custom Property to part
We are already here so we kinda don't need a link
Flores
RE: Custom Property to part
RE: Custom Property to part
CODE
The "dummy" variable really doesn't do anything. It's just there to create an equation that is valid for SW. The VBA code on the right-hand side of the "=" is what sets the material. This equation will change the material for the currently active configuration to whatever is in the "Material" custom property. The value in "Material" must match (case-sensitive) a material name in the default .sldmat material database. If you want to specify a different database, change the first "" to a full path (including .sldmat) inside quotes. If your custom property for material is named something different from "Material", change the equation to match.
The above equation will reference the part-level custom properties. You can use configuration-specific custom properties if you want. Just replace the second "" with
Part.ConfigurationManager.ActiveConfiguration.Name
no quotes. Each configuration's material will be driven by the configuration-specific "Material" custom property.
-handleman, CSWP (The new, easy test)
RE: Custom Property to part
-handleman, CSWP (The new, easy test)
RE: Custom Property to part
RE: Custom Property to part
CODE
The custom property name is also case-sensitive, by the way, so "rawmaterial" is not the same as "RawMaterial".
-handleman, CSWP (The new, easy test)
RE: Custom Property to part
-handleman, CSWP (The new, easy test)
RE: Custom Property to part
FYI ... the equation in the sample part is reporting a syntax error for SW2009-SP1.
RE: Custom Property to part
Does this equation work?
"dummy"=msgbox("hello")
-handleman, CSWP (The new, easy test)
RE: Custom Property to part
RE: Custom Property to part
-handleman, CSWP (The new, easy test)
RE: Custom Property to part
I was wrong previously when I said that the custom property name is case-sensitive. It isn't in 2008. If your property name is "RawMaterial", you can put "RAWMATERIAL" or "rawmaterial" in your equation and it will still work.
Now... here's the really screwy thing for 2009 (at least SP1). If the case matches exactly between the equation and the custom property, you get the syntax error. That's right, if the case does match, you get the error. If the case doesn't match, it works just fine. So if your property name is "RawMaterial", you can use anything in the equation except "RawMaterial". "RAWMATERIAL", "rawMATERIAL", "RAWmaterial", as long as the case doesn't match exactly it will work.
I think that's one of the screwiest things I've seen yet.
I've attached the 2009 version, with the equation modified to look for "MatErial".
-handleman, CSWP (The new, easy test)
RE: Custom Property to part
So, what was happening before was that SW saw the string "Material" in the equation, checked the custom properties, and found a non-numeric value there, which throws up the syntax error. Because the new custom property referencing capability is case sensitive, it doesn't match "MATERIAL" up with "Material".
-handleman, CSWP (The new, easy test)
RE: Custom Property to part
I think you should go work for SolidWorks.
RE: Custom Property to part
RE: Custom Property to part
I have thought about looking into seeing what opportunities might look like at a VAR... Not sure if I could be polite enough to actually deal with end users.
-handleman, CSWP (The new, easy test)