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

Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

Need to Implement Save A copy feature using VB.net

rreddy-2
5-Regular Member

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
PARTHIBAN_K
15-Moonstone
(To:rreddy-2)

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

Parthiban Kannan

href="https://www.linkedin.com/in/parthiban-kannan/" target="_blank"
rreddy-2
5-Regular Member
(To:PARTHIBAN_K)

Thanks Parthiban, your logic works fine for me.

But how to retain suppressed parts in assembly.

PARTHIBAN_K
15-Moonstone
(To:rreddy-2)

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

Parthiban Kannan

href="https://www.linkedin.com/in/parthiban-kannan/" target="_blank"
rreddy-2
5-Regular Member
(To:PARTHIBAN_K)

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.

TomasLoun
4-Participant
(To:rreddy-2)

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

Top Tags