- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I am trying to use the thicken features on multiple faces of multiple bodies, but I cannot get more than one thicken feature, my program stops after the first iteration.
Here is the code I tried :
Private Sub MultipleThickens()
Dim oApp As Inventor.Application
Set oApp = ThisApplication
Dim oPartDoc As PartDocument
Set oPartDoc = oApp.ActiveDocument
Dim oCompDef As PartComponentDefinition
Set oCompDef = oPartDoc.ComponentDefinition
Dim oSB As SurfaceBody
Dim oFacesCol As FaceCollection
Set oFacesCol = oApp.TransientObjects.CreateFaceCollection
Dim oFace As Face
Dim oThickFeat As ThickenFeature
For Each oSB In oCompDef.SurfaceBodies
For Each oFace In oSB.Faces
Call oFacesCol.Add(oFace)
Next
Set oThickFeat = oCompDef.Features.ThickenFeatures.Add(oFacesCol, 5, kNegativeExtentDirection, kCutOperation)
Call oFacesCol.Clear
Next
End Sub
How should I do to create a new thicken feature for each body iteration ?
Thanks !
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi @Aririmo. I tried your code on a single, simple block model in a part document, and it failed, so I played around with it a bit to get it to work. There are several reasons why this might fail, but one of the reasons it failed for me was the size of the offset. Another reason for failure is if not all faces in the input face collection are connected. The offset distance you specify can either be a raw numerical value, or a String. If you supply a raw numerical value, it will be interpreted as 'database units' for length (centimeters). If you supply a String, it can still be a numerical value within the quotes, but you can also specify units. If you use the string, but don't specify units, it will default to 'document units' for length. This messes some folks up, due to units conversions. If the size is too much it will either not be able to compute it, or it may create a feature with the little information symbol beside it, because the feature had no physical effect on the model.
PS. If you want it to continue trying to create more features, even if it fails to create one, or encounters an error, you can put the line that creates the feature after the 'On Error Resume Next' phrase.
Wesley Crihfield
(Not an Autodesk Employee)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I did have a quick look at and this iLogic code did work for me.
Dim oPartDoc As PartDocument = ThisDoc.Document
Dim oCompDef As PartComponentDefinition = oPartDoc.ComponentDefinition
For Each oSB As SurfaceBody In oCompDef.SurfaceBodies
Dim oFacesCol As FaceCollection = ThisApplication.TransientObjects.CreateFaceCollection()
For Each oFace As Face In oSB.Faces
Call oFacesCol.Add(oFace)
Next
oCompDef.Features.ThickenFeatures.Add(oFacesCol, 0.5,
PartFeatureExtentDirectionEnum.kNegativeExtentDirection,
PartFeatureOperationEnum.kCutOperation)
Next
Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
Blog: hjalte.nl - github.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Thank you @JelteDeJong, even if your solution did not work with VBA, it works on Ilogic.
It's still a mystery why it does not work with VBA...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report