how to use ShrinkwrapComponents and ShrinkwrapDefinition API

how to use ShrinkwrapComponents and ShrinkwrapDefinition API

liminma8458
Collaborator Collaborator
1,600件の閲覧回数
6件の返信
メッセージ1/7

how to use ShrinkwrapComponents and ShrinkwrapDefinition API

liminma8458
Collaborator
Collaborator

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 5.3; Windows 11 pro 64 bit version 24H2; Office 2013 64 bit

Download iCable in App Store to Create Cables Easily

0 件のいいね
解決済み
1,601件の閲覧回数
6件の返信
返信 (6)
メッセージ2/7

liminma8458
Collaborator
Collaborator

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 5.3; Windows 11 pro 64 bit version 24H2; Office 2013 64 bit

Download iCable in App Store to Create Cables Easily

0 件のいいね
メッセージ3/7

AlexFielder
Advisor
Advisor

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!

0 件のいいね
メッセージ4/7

liminma8458
Collaborator
Collaborator

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

Thanks
Limin
Inventor pro 2023 64 bit update 5.3; Windows 11 pro 64 bit version 24H2; Office 2013 64 bit

Download iCable in App Store to Create Cables Easily

0 件のいいね
メッセージ5/7

AlexFielder
Advisor
Advisor

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

0 件のいいね
メッセージ6/7

dgreatice
Collaborator
Collaborator
解決済み

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
メッセージ7/7

liminma8458
Collaborator
Collaborator

Perfect!

Thank you very much!

Thanks
Limin
Inventor pro 2023 64 bit update 5.3; Windows 11 pro 64 bit version 24H2; Office 2013 64 bit

Download iCable in App Store to Create Cables Easily

0 件のいいね