Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
Hi All,
I want to implement Save a Copy(Pack & Go) feature using vb.net.
I want to copy all parts in assembly(including hidden parts,Suppressed objects) and its drawing from a assembly.
Need your help in implementing the feature.
Do you mean "Save a copy of drawing for the Main assembly and also for it sub-assembly and sub-components"
I hope in VB API you cannot rename the sub-component or sub-assembly during save a copy
(But you have to work around & it may be tricky to do)
1. You have to copy and place all the components and drawings in a separate working directory
2. Retrieve the Main Assembly
IpfcBaseSession.RetrieveModel()
3. Now all the models loaded into the session memory
4. Using the For loop and if condition retrieve all the drawing into session memory
For i=0 to IpfcBaseSession.ListModels().Count - 1
Try
' Create Descriptor for the ModelName with Drawing File type and retrieve it
Dim IMDescriptor As IpfcModelDescriptor = CMDescriptor.CreateFromFileName("ModelName.drw") ' Get the name from ListModels()
IpfcBaseSession.RetrieveModel( IMDescriptor )
Catch (Exception ex)
Continue For ' If the drawing available it will load into session else go to next model
End Try
Next
5. Rename all the 3D models and assemblies in the session memory
IpfcModel.Rename()
6. Save all the Models
IpfcModel.Save()
7. Rename all the Drawings then Save all the drawing
IpfcModel.Rename()
IpfcModel.Save()
8. Don't clear the Session until the process complete
Hope this will help
Thanks Parthiban, your logic works fine for me.
But how to retain suppressed parts in assembly.
WIth in you For Loop Try cast the model to solid using
Dim ISolid as IpfcSolid = CType(Model, IpfcSolid) ' Model is the IpfcModel from BaseSession.ListModels()
If ISolid.HasRetrievalErrors == True Then
' The Model is Either Suppressed or Frozen → You've to retrieve the model
{"Your Code Here to Retrieve the model using Model Descriptor"}
End If
i tried ISolid.HasRetrievalErrors == True, but i did return false. The suppressed parts are not displayed in model, it did not copy suppressed parts.
Is there any other way possible to backup suppressed parts?
Thanks In Advance.
I am not sure, if VB API will provide you all the functionality you need to this (as Parthiban Kannan is writing).
We have develop such an application in Pro/Toolkit - COGRAS - Supputils