Is there a iLogic rule for open a part and save in step from a assembly?

Is there a iLogic rule for open a part and save in step from a assembly?

Anonymous
Not applicable
648 Views
5 Replies
Message 1 of 6

Is there a iLogic rule for open a part and save in step from a assembly?

Anonymous
Not applicable

Hello

 

Ich want to use a rule to open a part from a assembly file, and save it as STEP

Is it posible?

When yes, please help me!

 

Than you!

0 Likes
649 Views
5 Replies
Replies (5)
Message 2 of 6

RodrigoEiras
Advocate
Advocate

 

Sometimes it is faster if you search the forum before posting...Smiley Wink

 

http://forums.autodesk.com/t5/inventor-customization/macro-to-export-in-step-like-my-macro-pdf/m-p/5...

0 Likes
Message 3 of 6

Anonymous
Not applicable

thank you but thas not that!

 

I want to open three files (from 10), and save it to STEP

0 Likes
Message 4 of 6

RodrigoEiras
Advocate
Advocate

 

One suggestion:

 

You will get better results if instead of dropping bits of information after each post, you invest some time in explaining precisely what you want to do. That would help people to offer you a much more focused answer. And as a result you will get much better answers to your questions.

 

Best regards

 

 

 

 

 

 

 

 

0 Likes
Message 5 of 6

Anonymous
Not applicable

Ok hier are a picure what i Want.

 

I want to make a rule, to take one part from the Browser of the assembly and save it on my local disc as a step file.

 

Thar rule schall every time when i save the assembly file

0 Likes
Message 6 of 6

RodrigoEiras
Advocate
Advocate

 

I think this is basically what you need.

 

I hope it helps!

 

P.D.: To trigger it every time you save the file you should trigger it "Before Save Document"

 

Capture.JPG

 

SyntaxEditor Code Snippet

        'Get the component document
        Dim oDoc As Inventor.AssemblyDocument
           oDoc = ThisApplication.ActiveDocument 'This is the assembly
        Dim oCompDef As Inventor.ComponentDefinition
        oCompDef = oDoc.ComponentDefinition
        
        'Get the component file name
        Dim oDoc2 As Inventor.Document
        Dim oCompOcc As ComponentOccurrence
                
        For Each oCompOcc In oCompDef.Occurrences
            If oCompOcc.Name = "TestPart:1" 'here you can define which part you want to convert
                oDoc2 = oCompOcc.Definition.Document
                Trace.Writeline(oDoc2.DisplayName)
                Trace.Writeline(oDoc2.FullDocumentName)
            End If
        Next    
        

    ' Get the STEP translator Add-In.
    Dim oSTEPTranslator As TranslatorAddIn
    oSTEPTranslator = ThisApplication.ApplicationAddIns.ItemById("{90AF7F40-0C01-11D5-8E83-0010B541CD80}")

    If oSTEPTranslator Is Nothing Then
        MsgBox ("Could not access STEP translator.")
        Exit Sub
    End If

    Dim oContext As TranslationContext
    oContext = ThisApplication.TransientObjects.CreateTranslationContext
    Dim oOptions As NameValueMap
    oOptions = ThisApplication.TransientObjects.CreateNameValueMap
    If oSTEPTranslator.HasSaveCopyAsOptions(ThisApplication.ActiveDocument, oContext, oOptions) Then
        ' Set application protocol.
        ' 2 = AP 203 - Configuration Controlled Design
        ' 3 = AP 214 - Automotive Design
        oOptions.Value("ApplicationProtocolType") = 3

        ' Other options...
        'oOptions.Value("Author") = ""
        'oOptions.Value("Authorization") = ""
        'oOptions.Value("Description") = ""
        'oOptions.Value("Organization") = ""

        oContext.Type = kFileBrowseIOMechanism

        Dim oData As DataMedium
        oData = ThisApplication.TransientObjects.CreateDataMedium
        oData.FileName = "C:\Users\ERS\Desktop\temptest.stp"


        oSTEPTranslator.SaveCopyAs(oDoc2, oContext, oOptions, oData)
        
    End If

 

 

 

0 Likes