I want to simply set a custom iproperty as the Description in each part file within my assembly. I can do this easily at part level with ilogic but I want to be able to run the rule from the assembly level and all the parts run the rule. I am struggling to find a way to do this.
I think this may be the best method I have found but I think it must be far easier?
Solved! Go to Solution.
Will the description be something that is derived from a parameter within each part, a manual entry, or perhaps a parameter in the assembly, OR something just hardcoded?
We have a PLM system which populates a custom iproperty with the description entered in the PLM. We also have some old parts which have the description in the Description field but not the custom iproperty. I want to write a rule which will ensure I can call the Description field in a parts list. If I do this currently some descriptions are blank.
Can you help?
So your PLM system does a lot of the grunt work of populating the custom iprop. You just want to make sure that the custom iprop exists, correct?
I want to make sure that if the custom iprop exists it is copied to the Description field under the project tab. I think it's dangerous to copy the other way as this is data placed in the part from the PLM system. That way I can run the rule in the assembly and ensure I have the description for each part in my Parts List. Some of the legacy parts in the PLM had the description stored in the Description field.
I do not know why it was changed......
Alright. I made this during lunch just now, and have not tested it, but you should be able to throw this into a rule in the main assembly file and let it do its thing.
Basically it just goes through all of the parts in the assembly, and will set the Project's - Description iproperty, to match a custom iproperty of your desire. Just be sure to replace the custom iproperty name in the code with the one you'll be using.
Dim openDoc As Document openDoc = ThisDoc.Document Dim docFile As Document If openDoc.DocumentType = 12291 Then For Each docFile In openDoc.AllReferencedDocuments If docFile.DocumentType = 12290 Then iProperties.Value(docFile.DisplayName, "Project", "Description") = iProperties.Value(docFile.DisplayName, "Custom", "YOURiPropNAMEHERE") End If Next End If
Hi Sorry for the delay replying. Start of the day in the UK now.
Thanks a lot for the help and the rule. I tried it and receive an error when it's run.
I've used a test assembly. Here is the detail of the message
I just tested this. It should work, but it assumes that you have your occurrence names set to the filename, and that there is always one of them named with the suffix of “:1” (So if you have a filename called FrankyLovesCake.ipt it assumes the Occurrence name is FrankyLovesCake:1).
Later on, I’ll try to make this more solid and less awful.
New Code :
Dim openDoc As Document
openDoc = ThisDoc.Document
Dim docFile As Document
If openDoc.DocumentType = 12291 Then
For Each docFile In openDoc.AllReferencedDocuments
If docFile.DocumentType = 12290 Then
Dim OccName As String
OccName = Left(docFile.DisplayName, Len(docFile.DisplayName) - 4) & ":1"
iProperties.Value(OccName, "Project", "Description") = iProperties.Value(OccName, "Custom", "CUSTOM_NAME_HERE")
Thanks I really appreciate the help. The file name and occurrence names differ unfortunately. As an example. The file name = doc-0000837756_0.ipt yet the occurrence name = DOC-0000837756-PART_GLFT_0003-PART-ID-2301831:1
This is generated by the software we have which links to the PLM.
Yeah. I figured that might be the case. Once I get some time, I'll change how it goes about messing with things, and maybe all will be well in the end!.
Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register