Copy a solid with ilogic in a part file

Copy a solid with ilogic in a part file

jletcher
Advisor Advisor
412 Views
1 Reply
Message 1 of 2

Copy a solid with ilogic in a part file

jletcher
Advisor
Advisor

 

Is there a way to use ilogic to copy solids?

 

 What I want to do is instead of using a pattern I want to copy the solid to new locations as a new solid.

 

Thanks

 

 

 

 

0 Likes
413 Views
1 Reply
Reply (1)
Message 2 of 2

WCrihfield
Mentor
Mentor

Here's a little something I put together (using bits and pieces of code from all over mixed with my own).

It's fairly basic, and doesn't move the second part very far (you can customize where you want it to go by manipulating the oMatrix further).  The process sure seems way to difficult/complex for the simplicity of what we're trying to do here, but hopefully they will create/expose more methods to improve it in the near future.

Dim oPDoc As PartDocument = ThisApplication.ActiveDocument
Dim oPDef As PartComponentDefinition = oPDoc.ComponentDefinition
Dim oTO As TransientObjects = ThisApplication.TransientObjects
Dim oTG As TransientGeometry = ThisApplication.TransientGeometry
Dim oTBrep As TransientBRep = ThisApplication.TransientBRep
Dim oBody As SurfaceBody = oPDef.SurfaceBodies.Item(1)
Dim oTBody As SurfaceBody = oTBrep.Copy(oBody)
Dim oMatrix As Inventor.Matrix = oTG.CreateMatrix()
Dim oVector As Vector = oTG.CreateVector(12,12,0)
oMatrix.SetTranslation(oVector)
oTBrep.Transform(oTBody, oMatrix)
Dim oNPBFDef As NonParametricBaseFeatureDefinition = oPDef.Features.NonParametricBaseFeatures.CreateDefinition
Dim oColl As ObjectCollection = oTO.CreateObjectCollection
oColl.Add(oTBody)
oNPBFDef.BRepEntities = oColl
oNPBFDef.OutputType = BaseFeatureOutputTypeEnum.kSolidOutputType
Dim oNPBFeat As NonParametricBaseFeature = oPDef.Features.NonParametricBaseFeatures.AddByDefinition(oNPBFDef)

If this solved your problem, or answered your question, please click ACCEPT SOLUTION.
Or, if this helped you, please click 'LIKE' 👍.

Vote For My IDEAS 💡and Explore My CONTRIBUTIONS

Inventor 2020 Help | Inventor Forum | Inventor Customization Forum | Inventor Ideas Forum

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes