Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Shell feature, possible bug?

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
Jpfeifer5TC7R
303 Views, 4 Replies

Shell feature, possible bug?

Good afternoon, 

 

I'm working on a lofted feature where I need to shell the item depending on the thickness of the tube in which it will represent. In this situation there are only two items that need this style of creation. Due to this, I'm working with two set thicknesses. For some reason, the 2" item works flawlessly and sets the shell thickness to 1/8". However the 3" item has a 3/16" shell thickness that will not be accepted within the ilogic rule.

 

If I attempt to create the shell feature at 1/8" both items will shell without a problem. As soon as I attempt to set the shell to 3/16" on the 3" item I get an unspecified error. Below are the directions I've attempted to solve this and the things I've found to be possible, outside of the ilogic rule. 

 

I can create the feature manually at 3/16" without a problem. 

I can program the creation to the outside at 3/16". Then manually set the feature to the inside. 

I can program the creation to the inside at 1/8". then manually set the feature to 3/16".

I cannot program the creation at 3/16" to the outside, then set the direction to the inside within the rule - same error.

I cannot program the creation at 1/8", then set the distance/value to 3/16" in the ilogic rule.  

I've tried changing the faces within the collection for the shell without success. 

I've removed the face collection without success. 

I have not attempted to change the thickness of different faces. 

 

Further information/Pictures:

Both sketches controlling the loft feature to then be shelled are fully constrained. 

It's an asymmetric loft feature. That is, the cone is not concentric.  

Sketches isometric.jpg

Above is the isometric view of the two circles in question. 

Sketches lofted.jpg

Above is the basic loft that's created. 

Shells fine at .1875 manually.jpg

The above does not show the cut being added, but even with the cut it functions fine. 

Facing sketch circles. .jpg

Facing the front of the sketches shows the circles orientation to each other. 

Added cut could be causing a problem.jpg

The above is a 45 deg cut to the bottom side of the straight portion. 

Not possible sketch.jpg

The above picture is the finished shape and thickness: Problem in Ilogic

Working sketch.jpg

Above is the shape and thickness that can be programed in Ilogic. 

 

 

 

	Dim TrimExt As ExtrudeFeature = oCompDef.Features.ExtrudeFeatures.Add(TrimExtDef)
		TrimExt.Name = "Trim extrusion: " & Fitting_Index
		TrimExt.SetAffectedBodies(Bodycollection)
		Dim SetShellThickness As Double = Nothing
		SetShellThickness = .125 * 2.54 '(Flange_Thickness / 2) * 2.54 'This value being set to Flange_Thickness. Something in here doesn't like more than 1/8"
	
		Dim TubeShellDef As ShellDefinition = Nothing
		'Object collection holding the sides of the tube EXT, this will apply to both the small and larger tube ext from program. 
		Dim ShellFaceCollection As FaceCollection = oTO.CreateFaceCollection
		ShellFaceCollection.Add(TubeExt.Faces.item(2))
		ShellFaceCollection.Add(TubeExt.Faces.item(3))
		
	
	If TestingBool = True Then
		TubeShellDef = oCompDef.Features.ShellFeatures.CreateShellDefinition(ShellFaceCollection, SetShellThickness, kOutsideShellDirection)
			oDoc.Update
		TubeShellDef.Direction = kInsideShellDirection
			oDoc.Update
	Else
		TubeShellDef = oCompDef.Features.ShellFeatures.CreateShellDefinition(Nothing, SetShellThickness, kOutsideShellDirection)
		Dim ShellTrimSketch As PlanarSketch = oCompDef.Sketches.Add(FlangePlane)
		ShellTrimSketch.Name = "Shell sketch: " & Fitting_Index
		
		Dim ShllTrimCir As SketchEntity = ShellTrimSketch.AddByProjectingEntity(FlangeODCir)
		
		Dim ShellTrimProfile As Profile = ShellTrimSketch.Profiles.AddForSolid
		
		Dim ShellTrimDef As ExtrudeDefinition = oCompDef.Features.ExtrudeFeatures.CreateExtrudeDefinition(ShellTrimProfile, kCutOperation)
	
		ShellTrimDef.SetDistanceExtent((Flange_Thickness / 2) * 2.54, kPositiveExtentDirection)
	
		Dim ShellTrimExt As ExtrudeFeature = oCompDef.Features.ExtrudeFeatures.Add(ShellTrimDef)
		ShellTrimExt.SetAffectedBodies(TubeCollection)
		ShellTrimExt.Name = "Shell trim: " & Fitting_Index	
	End If 
		'When created a object collection for just the tube object was created to be used as the item for the shell to apply to. 
		Dim TubeShell As ShellFeature = oCompDef.Features.ShellFeatures.Add(TubeShellDef)
		TubeShell.SetAffectedBodies(TubeCollection)
		TubeShell.Name = "Tubeshell: " & Fitting_Index
		
		oDoc.Update

 

The above shows the a testing bool. This will eventually be changed to when the fittings are 2 or 3" it will enter this specific creation. Ignore the else of this, that part works fine.  

 

@WCrihfield 

@JelteDeJong 

@A.Acheson 

 

 

 

 

 

 

 

 

 

 

 

Tags (2)
4 REPLIES 4
Message 2 of 5

Good afternoon again friends, 

 

Bumping this topic as I've dug out some more information on this and as to why it might be failing. In the following code, I've created a loft feature from two circles. This creates an object with 3 sides. I created a face collection to hold item 1 and item 2 from this feature to be passed into the shell definition. 

 

From here I ran the code getting the same errors as the previous post. However, this time I searched through the entire feature evaluating the face area. When you measure these amounts they directly match the size needed. While also giving me the exact faces needed to be passed into this collection for the shell definition. 

 

However, I kept getting errors and running into problems creating the shell. So I messed with the inside/ouside portion of the shell. This is where I found the problem, the shell feature definition seemingly is ignoring the face collection object and applying the shell to the main solid object in the model browser. Any insights from the community? 

 

 

 

             Dim TopProfile As Profile = TopConicalSketch.Profiles.AddForSolid
			Dim BotProfile As Profile = LargeConicalSketch.Profiles.AddForSolid
			
			Dim LoftProfileCol As ObjectCollection = oTO.CreateObjectCollection
			LoftProfileCol.Add(TopProfile)
			LoftProfileCol.Add(BotProfile)
			
			MessageBox.Show("LoftProfile collection items: " & LoftProfileCol.Count)
			
			Dim LoftExtDef As LoftDefinition = oCompDef.Features.LoftFeatures.CreateLoftDefinition(LoftProfileCol, kNewBodyOperation)
			
			Dim LoftExt As LoftFeature = oCompDef.Features.LoftFeatures.Add(LoftExtDef)
			GussetCollection.Add(LoftExt) 'This is adding the solid object that represents the loft into a collection that way it can be used to be cut by the trim profile later. 
			
			'Create shell definition and face collections to be used to shell this conical loft. We must figure this out for use in other parts when we go to update them further. 
			Dim LoftFaceCol As FaceCollection = oTO.CreateFaceCollection
			
			Dim oSmallFace As Face = LoftExt.Faces.Item(1)
			Dim oLargeFace As Face = LoftExt.Faces.Item(2)
			LoftFaceCol.Add(oSmallFace)
			LoftFaceCol.Add(oLargeFace)
			
	
		Dim i As Integer = 1
		For Each Face As Face In LoftExt.Faces
			Logger.Info("Face number: " & i & " Face area:" & Face.Evaluator.area) 
			i = i + 1
		Next
		
		'The above is checking the three sides of the conical creation. Notes:
		'Face1 = bottom = 1274.49 cm
		'Face2 = top = 94.235 cm
		'Face3 = cone = 2360.506 cm
		'All these values reflect the measurements taken from inside the model. 
	
			Dim ShellLoftDef As ShellDefinition = oCompDef.Features.ShellFeatures.CreateShellDefinition(LoftFaceCol, Gus_plate_Thickness * 2.54, kOutsideShellDirection)
																										' ^^^^^^^^^ This is applying the shell feature to the main solid in the part. 
			
			Dim ShellLoft As ShellFeature = oCompDef.Features.ShellFeatures.Add(ShellLoftDef)

 

Edited to add: I switched the for each loop to target just the faces within the collection. This gives me a logged result of 2 items, both items match the area I would expect. The shell definition itself is ignoring the faces provided. 

 

 

 

 

Message 3 of 5

@Jpfeifer5TC7R  , I tried to understand and reproduce the issue, but was unable to do so.

 

Attached is a 2024 example file that works as expected, creating an inside and outside shell on a lofted cone. Note this example uses named entities to get the faces.

 

Curtis_Waguespack_0-1723758194468.png

 

 

 

 

oInput = InputRadioBox("Prompt", "Inside", "Outside", True, Title := "ilogic")

Dim oDoc As PartDocument = ThisDoc.Document
Dim oDef As PartComponentDefinition = oDoc.ComponentDefinition
Dim oShellFeats As ShellFeatures = oDef.Features.ShellFeatures
Try : oShellFeats.Item("MyShell").Delete : Catch : End Try

Dim oFaces As FaceCollection = ThisApplication.TransientObjects.CreateFaceCollection
Dim oNamedEntities = ThisDoc.NamedEntities

oFace1 = oNamedEntities.FindEntity("Top Face")
oFace2 = oNamedEntities.FindEntity("Bottom Face")
oFaces.Add(oFace1)
oFaces.Add(oFace2)

Dim direction As ShellDirectionEnum
If oInput = True Then 
	direction = ShellDirectionEnum.kInsideShellDirection
Else
	direction = ShellDirectionEnum.kOutsideShellDirection
End If
Dim oShellDef As ShellDefinition = oShellFeats.CreateShellDefinition(oFaces, 0.1875 * 2.54, direction)
Dim oShellFeat As ShellFeature = oShellFeats.Add(oShellDef)
oShellFeat.name = "MyShell"

 

Message 4 of 5

I was able to replicate the issue in 2025 version this morning. First I created the rule and ran the part, coming to the same conclusion as you. I then created a solid manually inside the model window. From there I ran the rule and the shell started applying to the first solid. Even though what's being targeted in the code and logged should be the correct faces of the lofted feature. 

 

Attached are the part file and several pictures breaking down the model/rule. 

 

Also, this might have needed to be a second post. The first post seems to be a problem caused by the shape itself. Not allowing Inventor to apply the shell inside due to the angle cut, but that solid targets the correct face. This reply to myself and code below is a secondary issue where what I'm telling inventor to target is seemingly ignored. 

 

 

Existing solid supressed.jpg

Unspressed before run.jpg

Ran Unspressed.jpg

Creation when solid is present.jpg

Face items logged.jpg

 

 

 

 

 

 

Sub main()

	Dim oDoc As PartDocument = ThisApplication.ActiveDocument
	Dim oCompDef As PartComponentDefinition = oDoc.ComponentDefinition
	
	Dim oTO As TransientObjects = ThisApplication.TransientObjects
	Dim oTG As TransientGeometry = ThisApplication.TransientGeometry
	
	Dim ProfileCollection As ObjectCollection = oTO.CreateObjectCollection
	Dim FaceCollection As FaceCollection = oTO.CreateFaceCollection
	
	Dim oUCS_Def As UserCoordinateSystemDefinition = oCompDef.UserCoordinateSystems.CreateDefinition
	Dim oUCS As UserCoordinateSystem = oCompDef.UserCoordinateSystems.Add(oUCS_Def)
	
	Dim BottomSketch As PlanarSketch = oCompDef.Sketches.Add(oUCS.XZPlane)
	
	Dim BottomCenPoint As SketchPoint = BottomSketch.AddByProjectingEntity(oUCS.Origin)
	
	Dim BottomCircle As SketchCircle = BottomSketch.SketchCircles.AddByCenterRadius(BottomCenPoint, 10 * 2.54)
	
	'Constraints
	Dim BotCenCon As GeometricConstraint = BottomSketch.GeometricConstraints.AddCoincident(BottomCircle.CenterSketchPoint, BottomCenPoint)
	Dim BotCirDia As DimensionConstraint = BottomSketch.DimensionConstraints.AddDiameter(BottomCircle, oTG.CreatePoint2d(15, 15))
	
	'Create top plane, sketch and circle object. 
	Dim TopPlane As WorkPlane = oCompDef.WorkPlanes.AddByPlaneAndOffset(oUCS.XZPlane, 12 * 2.54)
	TopPlane.Visible = False
	
	Dim TopSketch As PlanarSketch = oCompDef.Sketches.Add(TopPlane)
	
	Dim TopCenPoint As SketchPoint = TopSketch.AddByProjectingEntity(oUCS.Origin)
	
	Dim TopCircle As SketchCircle = TopSketch.SketchCircles.AddByCenterRadius(TopCenPoint, 5 * 2.54)
	
	'Constraints
	Dim TopCenCon As GeometricConstraint = BottomSketch.GeometricConstraints.AddCoincident(TopCircle.CenterSketchPoint, TopCenPoint)
	Dim TopCirDia As DimensionConstraint = BottomSketch.DimensionConstraints.AddDiameter(TopCircle, oTG.CreatePoint2d(20, 20))
	
	
	'Add sketches to profile, then place profiles into collection
	Dim BottomProfile As Profile = BottomSketch.Profiles.AddForSolid
	Dim TopProfile As Profile = TopSketch.Profiles.AddForSolid
	
	ProfileCollection.Add(BottomProfile)
	ProfileCollection.Add(TopProfile)
	
	'Create lofted feature. 
	Dim LoftExtDef As LoftDefinition = oCompDef.Features.LoftFeatures.CreateLoftDefinition(ProfileCollection, kNewBodyOperation)
	Dim LoftExt As LoftFeature = oCompDef.Features.LoftFeatures.Add(LoftExtDef)
	
	Dim oFace1 As Face = LoftExt.Faces.Item(1)
	Dim oFace2 As Face = LoftExt.Faces.Item(2)
	Dim oFace3 As Face = LoftExt.Faces.Item(3)
	
	Logger.Info("Normal faces area, Face1: " & oFace1.Evaluator.Area & vbCrLf & " Face2: " & oFace2.Evaluator.Area & vbCrLf & " Face3: " & oFace3.Evaluator.Area)
	
	
	FaceCollection.Add(oFace1)
	FaceCollection.Add(oFace2)
	Dim i as Integer = 0 
        Dim ii as Integer = 0

	For Each Face As Face In LoftExt.Faces
                i = i + 1
		Logger.Info("LoftExt faces item: " & i & " Area: " & 
face.Evaluator.Area)
	Next
	
	For Each face As face In FaceCollection
                ii = ii + 1
		Logger.Info("FaceCollection item: " & ii & " Area: " & face.Evaluator.Area)
	Next
	
	
	
	Dim ShellDef As ShellDefinition = oCompDef.Features.ShellFeatures.CreateShellDefinition(FaceCollection, .1875 * 2.54, kInsideShellDirection)
	
	Dim ShellFeat As ShellFeature = oCompDef.Features.ShellFeatures.Add(ShellDef)
	

	
End Sub

 

 

 

 

Message 5 of 5

I found it, apparently selecting the faces to be targeted does not apply the surfacebody implication automatically. You must declare what surfacebody the feature is applied to after the feature creation.

 

Sub main()

	Dim oDoc As PartDocument = ThisApplication.ActiveDocument
	Dim oCompDef As PartComponentDefinition = oDoc.ComponentDefinition
	
	Dim oTO As TransientObjects = ThisApplication.TransientObjects
	Dim oTG As TransientGeometry = ThisApplication.TransientGeometry
	
	Dim ProfileCollection As ObjectCollection = oTO.CreateObjectCollection
	Dim FaceCollection As FaceCollection = oTO.CreateFaceCollection
	Dim BodyCollection As ObjectCollection = oTO.CreateObjectCollection
	
	Dim testBool As Boolean = True
	
	Dim oUCS_Def As UserCoordinateSystemDefinition = oCompDef.UserCoordinateSystems.CreateDefinition
	Dim oUCS As UserCoordinateSystem = oCompDef.UserCoordinateSystems.Add(oUCS_Def)
	
	Dim BottomSketch As PlanarSketch = oCompDef.Sketches.Add(oUCS.XZPlane)
	
	Dim BottomCenPoint As SketchPoint = BottomSketch.AddByProjectingEntity(oUCS.Origin)
	
	Dim BottomCircle As SketchCircle = BottomSketch.SketchCircles.AddByCenterRadius(BottomCenPoint, 10 * 2.54)
	
	'Constraints
	Dim BotCenCon As GeometricConstraint = BottomSketch.GeometricConstraints.AddCoincident(BottomCircle.CenterSketchPoint, BottomCenPoint)
	Dim BotCirDia As DimensionConstraint = BottomSketch.DimensionConstraints.AddDiameter(BottomCircle, oTG.CreatePoint2d(15, 15))
	
	'Create top plane, sketch and circle object. 
	Dim TopPlane As WorkPlane = oCompDef.WorkPlanes.AddByPlaneAndOffset(oUCS.XZPlane, 12 * 2.54)
	TopPlane.Visible = False
	
	Dim TopSketch As PlanarSketch = oCompDef.Sketches.Add(TopPlane)
	
	Dim TopCenPoint As SketchPoint = TopSketch.AddByProjectingEntity(oUCS.Origin)
	
	Dim TopCircle As SketchCircle = TopSketch.SketchCircles.AddByCenterRadius(TopCenPoint, 5 * 2.54)
	
	'Constraints
	Dim TopCenCon As GeometricConstraint = BottomSketch.GeometricConstraints.AddCoincident(TopCircle.CenterSketchPoint, TopCenPoint)
	Dim TopCirDia As DimensionConstraint = BottomSketch.DimensionConstraints.AddDiameter(TopCircle, oTG.CreatePoint2d(20, 20))
	
	'Add sketches to profile, then place profiles into collection
	Dim BottomProfile As Profile = BottomSketch.Profiles.AddForSolid
	Dim TopProfile As Profile = TopSketch.Profiles.AddForSolid
	
	ProfileCollection.Add(BottomProfile)
	ProfileCollection.Add(TopProfile)
	
	'Create lofted feature. 
	Dim LoftExtDef As LoftDefinition = oCompDef.Features.LoftFeatures.CreateLoftDefinition(ProfileCollection, kNewBodyOperation)
	Dim LoftExt As LoftFeature = oCompDef.Features.LoftFeatures.Add(LoftExtDef)
	BodyCollection.Add(LoftExt.SurfaceBodies.Item(1))
	
	Dim oFace1 As Face = LoftExt.Faces.Item(1)
	Dim oFace2 As Face = LoftExt.Faces.Item(2)
	Dim oFace3 As Face = LoftExt.Faces.Item(3)
	
	Logger.Info("Normal faces area, Face1: " & oFace1.Evaluator.Area & vbCrLf & " Face2: " & oFace2.Evaluator.Area & vbCrLf & " Face3: " & oFace3.Evaluator.Area)
	
	FaceCollection.Add(oFace1)
	FaceCollection.Add(oFace2)
	
	Dim i As Integer = 0
	Dim ii As Integer = 0

For Each Face As Face In LoftExt.Faces
		i = i + 1
		Logger.Info("LoftExt faces item: " & i & " Area: " & face.Evaluator.Area)
Next
	
For Each face As Face In FaceCollection
		ii = ii + 1
		Logger.Info("FaceCollection item: " & ii & " Area: " & face.Evaluator.Area)
Next
	
	
	Dim ShellDef As ShellDefinition = oCompDef.Features.ShellFeatures.CreateShellDefinition(FaceCollection, .1875 * 2.54, kInsideShellDirection)
		Logger.Info("Shell def faceSetCount: " & ShellDef.FaceSetCount)
	
	
	Dim ShellFeat As ShellFeature = oCompDef.Features.ShellFeatures.Add(ShellDef)
	ShellFeat.SetAffectedBodies(BodyCollection)
End Sub

 

 

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report