This challenge is going on for days now and I can't get it the way I would like to see it.
I have an assembly. In a 'For - Next' I get the 'Childeren' as Component2. They can be parts or subassemblies.
I can determine what type of document the 'Child' is.
In these documents I have Custom Properties that I would like to change to a new value.
And this is where I get stuck. I have tried different things but am unsuccessful in 1 thing; I have to open the file to change the value of the custom properties and then close it.
Having an assembly of about 1000 parts makes it a disco on my screen and that is not what I want (I have past the disco stage for many years now).
I have tried my logic (which did not work obviously)
With Component2 I am unable to find something that allows me to change the custom property so I have to go to CustomPropertyManager
Dim FullFileNameofChild as String
FullFileNameofChild = "Child'.GetPathName
Dim MyActiveDoc as ModelDoc2
MyActiveDoc = swApp.ActivateDoc2(FullFileNameofChild, (Silent) True, (Error), DOC_ERROR (as Long))
Dim MyCustProp as CustomPropertyManager
MyCustProp = MyActiveDoc.Extension.CustomPropertyManager("") <<<<< this is where it goes wrong.
I do not have a clue why. In VB.NET I can select it and no errors occur untill debugging. I am thinking that ActivateDoc2 is not doing what I think it should do.
Can someone point me in the right direction please.
Much appreciated.
You can modify the custom properties of assembly components while they are invisible (not opened it their own windows) as long as the component has a pointer to IModelDoc2. There are only several situations where the pointer is NULL:
So check this code:
______________________________________________
Regards, Artem Taturevych | Snr. Developer | IC3D ANZ
IC3DSteel – New Steel Solution for SolidWorks
translationXpert – SolidWorks files language translator
LinkedIn - SolidWorks API Group