Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
liminma8458
1452 Views, 6 Replies

how to use ShrinkwrapComponents and ShrinkwrapDefinition API

Hi,

From Inventor 2018, there are new API particularly to create Shrinkwrap, such as ReferenceComponents.ShrinkwrapComponents.CreateDefinition(), ShrinkwrapDefinition.RemoveChamfersStyle and so on. But I can't find any sample from anywhere. The samples I can find are all old style using DerivedAssemblyComponents as in http://adndevblog.typepad.com/manufacturing/2013/06/create-simplified-part-by-api.html.

 

Can someone provide some example how to use the new shrinkwrap API?

Thank you very much!

 

Thanks
Limin
Inventor pro 2023 64 bit update 2.1; Windows 10 pro 64 bit version 21H2; Office 2013 32 bit
liminma8458
in reply to: liminma8458

Autodesk used to provide something like Inventor2014API.ivb for some samples of new release API. But I can't find any for Inventor 2016, 2017, 2018 and 2019. Do you have any?

Thanks
Limin
Inventor pro 2023 64 bit update 2.1; Windows 10 pro 64 bit version 21H2; Office 2013 32 bit
AlexFielder
in reply to: liminma8458

This is the best sample I can find at the API Documentation site:

 

http://help.autodesk.com/view/INVNTOR/2019/ENU/?guid=GUID-9E92691A-7EEA-4BA8-94D7-3F64AA9ABA30

 

I hope it helps!

liminma8458
in reply to: AlexFielder

But they do not carry any shrinkwrap object; they just carry derivedassembly object, a different way.

Thanks
Limin
Inventor pro 2023 64 bit update 2.1; Windows 10 pro 64 bit version 21H2; Office 2013 32 bit
AlexFielder
in reply to: liminma8458

I see what you mean, it's odd that there's a new API presented but no examples of how to use it...

dgreatice
in reply to: AlexFielder

Sub createShrinkWrapWithDefinition()

Dim oApp As Application

Dim oAD As AssemblyDocument

Dim oACD As AssemblyComponentDefinition

 

Set oApp = ThisApplication

Set oAD = oApp.ActiveDocument

Set oACD = oAD.ComponentDefinition

oPath = oAD.FullDocumentName

 

Dim oPartDoc As PartDocument

Dim oPCD As PartComponentDefinition

Dim ShRDef As ShrinkwrapDefinition

Dim ShrComp As ShrinkwrapComponent

 

Set oPartDoc = oApp.Documents.Add(kPartDocumentObject, , True)

Set oPCD = oPartDoc.ComponentDefinition

Set ShRDef = oPCD.ReferenceComponents.ShrinkwrapComponents.CreateDefinition(oPath)

 

ShRDef.ActiveDesignViewRepresentation = "Default"
ShRDef.ActiveLevelOfDetailRepresentation = "Master"
ShRDef.ActivePositionalRepresentation = "Master"
'Call ShRDef.AdditionalExcludedOccurrences.Add(Object) 'Need User Selection
'Call ShRDef.AdditionalIncludedOccurrences.Remove(Object)'Need User Selection
ShRDef.BreakLink = False
ShRDef.CreateIndependentBodiesOnFailedBoolean = True
ShRDef.DeriveStyle = kDeriveAsSingleBodyWithSeams
ShRDef.IsAssociativeDesignView = False
'Call ShRDef.PreservedFeatures.Add(Object) 'Need User Selection
ShRDef.RemoveAllInternalVoids = False
ShRDef.RemoveChamfersDistanceRange = 10 'cm
ShRDef.RemoveChamfersStyle = kShrinkwrapRemoveByRange
ShRDef.RemoveFilletsRadiusRange = 10 'cm
ShRDef.RemoveFilletsStyle = kShrinkwrapRemoveByRange
ShRDef.RemoveHolesDiameterRange = 10 'cm
ShRDef.RemoveHolesStyle = kShrinkwrapRemoveByRange
ShRDef.RemoveInternalParts = False
ShRDef.RemovePartsBySize = True
ShRDef.RemovePartsSize = 10 'cm
ShRDef.RemovePocketsMaxFaceLoopRange = 10 'cm
ShRDef.RemovePocketsStyle = kShrinkwrapRemoveByRange
ShRDef.RenameComponent = True
ShRDef.UseColorOverrideFromSourceComponent = True

 

Set ShrComp = oPCD.ReferenceComponents.ShrinkwrapComponents.Add(ShRDef)


End Sub

Please use the ACCEPT AS SOLUTION or KUDOS button if my Idea helped you to solve the problem.

Autodesk Inventor Professional Certified 2014
liminma8458
in reply to: dgreatice

Perfect!

Thank you very much!

Thanks
Limin
Inventor pro 2023 64 bit update 2.1; Windows 10 pro 64 bit version 21H2; Office 2013 32 bit