API & derived part

API & derived part

Jef_E
Collaborator Collaborator
3,346 Views
4 Replies
Message 1 of 5

API & derived part

Jef_E
Collaborator
Collaborator

Hi there,

 

I'm trying to build a skeleton modeling tool, but i'm kinda stuck. I have a 'Master' part that creates sketches when required. After this i would like to create a new part (which is working) & then create a derived part (which is also working). But now i want to select not all sketches to derive but only a few based on the sketch name.

 

For now i have this: Create part, Set the derived component, Create the derived component.

        Dim oProjectMgr As DesignProjectManager = oInvApp.DesignProjectManager
        Dim oProject As DesignProject = oProjectMgr.ActiveDesignProject
        Dim oTemplatesPath As String = oProject.TemplatesPath

        Dim oNewDoc As PartDocument = oInvApp.Documents.Add(DocumentTypeEnum.kPartDocumentObject, oTemplatesPath & "\Standard.ipt", True)

        Dim oDerivedPartDef As DerivedPartUniformScaleDef
        oDerivedPartDef = oNewDoc.ComponentDefinition.ReferenceComponents.DerivedPartComponents.CreateUniformScaleDef(oMasterLoc)
        oDerivedPartDef.ScaleFactor = 1
        oDerivedPartDef.ExcludeAll()
        oDerivedPartDef.UseColorOverridesFromSource = False

        Call oNewDoc.ComponentDefinition.ReferenceComponents.DerivedPartComponents.Add(oDerivedPartDef)

So for my settings i chose .ExcludeAll to eliminate all unwanted sketches.

But now it needs to add Sketch1 & Sketch2 for example and also Param_A & Param_B

But i think if i know howto derive the sketches i can also figure out the parameters.

 

Any ideas?



Please kudo if this post was helpfull
Please accept as solution if your problem was solved

Inventor 2014 SP2
0 Likes
Accepted solutions (1)
3,347 Views
4 Replies
Replies (4)
Message 2 of 5

MechMachineMan
Advisor
Advisor

api HELP.JPG

 

Withn the Derived Part Transform Definition object, there is a Parameters Property that contains the Derived Part Entities Object. That should be a start.


--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
0 Likes
Message 3 of 5

Jef_E
Collaborator
Collaborator
Accepted solution

This works for, found it on the mod the machine site i think!

 

        Dim oDerivedComp As DerivedPartComponent = oNewDoc.ComponentDefinition.ReferenceComponents.DerivedPartComponents(1)
        oDerivedPartDef = oDerivedComp.Definition

        Dim oDerEntity As DerivedPartEntity
        For Each oDerEntity In oDerivedPartDef.Parameters
            If oDerEntity.ReferencedEntity.Name = "C02_t" Then
                oDerEntity.IncludeEntity = True
            End If
        Next


Please kudo if this post was helpfull
Please accept as solution if your problem was solved

Inventor 2014 SP2
Message 4 of 5

kevin_gauthierLLF3A
Observer
Observer

What is oMasterLoc?

0 Likes
Message 5 of 5

kevin_gauthierLLF3A
Observer
Observer

What is "oMasterLoc"?

0 Likes