cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Need to Implement Save A copy feature using VB.net

Participant

Need to Implement Save A copy feature using VB.net

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.

5 REPLIES 5
Highlighted

Re: Need to Implement Save A copy feature using VB.net

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

Re: Need to Implement Save A copy feature using VB.net

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

Re: Need to Implement Save A copy feature using VB.net

Thanks Parthiban, your logic works fine for me.

But how to retain suppressed parts in assembly.

Re: Need to Implement Save A copy feature using VB.net

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

Re: Need to Implement Save A copy feature using VB.net

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.