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

@Khoa_NguyenDang 

 

I had a very similar error with the thicken feature, the difference is I was creating the faces also using code that is being used for thicken.  Can you also explain when you are iterating through for loop what is "laminate"? is it a solid body or a feature? If you can send the file in which it works with your code and also the file in which it does not work maybe I can check if it is suitable.

 

I am not good with C#, but I have created the code long back in VB.Net where I was iterating through features and then finding a feature, that is a surface extrude, before iterating to the faces, I have cleared the object collection that is created (so that it will not try to thicken the face that is already thickened, try this I think that will do the trick) and I have added the counter, which is used for naming the thicken features. See below code for reference and see if it helps.

 

	FCount = 1
		Dim oFaceCol As FaceCollection
	   	oFaceCol = ThisApplication.TransientObjects.CreateFaceCollection
		For Each oFeat As PartFeature In oDef.Features
			If oFeat.Name.Contains("Partition")
				oFaceCol.Clear
				    For Each oFace In oFeat.SurfaceBodies.Item(1).Faces
	       			 	Call oFaceCol.Add(oFace)
							Dim oThickFeat As ThickenFeature
	    					        oThickFeat = oDef.Features.ThickenFeatures.Add(oFaceCol, "4",kSymmetricExtentDirection,kNewBodyOperation,False)
							oThickFeat.Name = "Thicken-Partition" & FCount
							FCount = FCount +1 
	  				 Next
			End If
		Next

 

If this has answered your question, please accept it as a solution.

 

Regards,

Dutt Thakar.

 

If this answer has solved your problem please ACCEPT SOLUTION and hit like if you found it helpful..!


Regards,
Dutt Thakar
LinkedIn