- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
@tiago.pereiraGB2J9 wrote:
Thanks so much for your reply @Curtis_Waguespack !
It works! Now I can create two solid bodies. But the ideal for me it´s to have different bodies. Telling you the main idea of the work is to build a hole model of an offshore platform, a frame structure. I was thinking about the problem in the last few days and building it with solid bodies doesn't seem to be the best way, because the model will be too large to work. Do you have any ideas for this?
Thanks again!
Hi @tiago.pereiraGB2J9 ,
I don't have any ideas on the offshore platform or if this is the best approach.
But I took another look at one of the other API examples and extracted what we needed to work with your original 2 cylinder example, this version creates 2 separate solids.
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
Dim oPartDoc As PartDocument oPartDoc = ThisDoc.Document ' a reference to the component definition. Dim oCompDef As PartComponentDefinition oCompDef = oPartDoc.ComponentDefinition ' a reference to the TransientBRep object. Dim oTransientBRep As TransientBRep oTransientBRep = ThisApplication.TransientBRep ' Create bottom and top points for the first cylinder. Dim oBottomPt As Point oBottomPt = ThisApplication.TransientGeometry.CreatePoint(0, 1, 0) Dim oTopPt As Point oTopPt = ThisApplication.TransientGeometry.CreatePoint(0, 3, 0) ' Create bottom and top points for the second cylinder. Dim oBottomPt2 As Point oBottomPt2 = ThisApplication.TransientGeometry.CreatePoint(0, 5, 0) Dim oTopPt2 As Point oTopPt2 = ThisApplication.TransientGeometry.CreatePoint(0, 7, 0) ' Create the cylinder body. Dim oCylinder1 As SurfaceBody oCylinder1 = oTransientBRep.CreateSolidCylinderCone(oBottomPt, oTopPt, 0.5, 0.5, 0.5) Dim oCylinder2 As SurfaceBody oCylinder2 = oTransientBRep.CreateSolidCylinderCone(oBottomPt2, oTopPt2, 0.5, 0.5, 0.5) Dim nonParaDef As NonParametricBaseFeatureDefinition nonParaDef = oCompDef.Features.NonParametricBaseFeatures.CreateDefinition Dim bodyColl_1 As ObjectCollection bodyColl_1 = ThisApplication.TransientObjects.CreateObjectCollection Call bodyColl_1.Add(oCylinder1) nonParaDef.BRepEntities = bodyColl_1 nonParaDef.OutputType = kSolidOutputType Dim oBaseFeature1 As NonParametricBaseFeature oBaseFeature1 = oCompDef.Features.NonParametricBaseFeatures.AddByDefinition(nonParaDef) Try : oBaseFeature1.Name = "Base1" : Catch : End Try Dim bodyColl_2 As ObjectCollection bodyColl_2 = ThisApplication.TransientObjects.CreateObjectCollection Call bodyColl_2.Add(oCylinder2) nonParaDef.BRepEntities = bodyColl_2 nonParaDef.OutputType = kSolidOutputType Dim oBaseFeature2 As NonParametricBaseFeature oBaseFeature2 = oCompDef.Features.NonParametricBaseFeatures.AddByDefinition(nonParaDef) Try : oBaseFeature2.Name = "Base2" : Catch : End Try