AddForSolid - Exclude Text

AddForSolid - Exclude Text

Anonymous
Not applicable
823 Views
6 Replies
Message 1 of 7

AddForSolid - Exclude Text

Anonymous
Not applicable
I am trying to create a sketch on a face for an extrusion. The sketch has a text box. I am having trouble excluding the text in a sketch otherwise all the closed geometries of the text get extruded.

I created an objectCollection and excluded the TextBox objects. Still not working.

Any ideas? Code sample perhaps?
0 Likes
824 Views
6 Replies
Replies (6)
Message 2 of 7

Anonymous
Not applicable
Never mind..."Combine" parameter was set to true.
0 Likes
Message 3 of 7

Anonymous
Not applicable
Actually...that did not help either. Same issue. I can't exclude text from the extrude command.
0 Likes
Message 4 of 7

Anonymous
Not applicable
I was able to get this to work using two different methods. The first is to
explictly define what you want in the profile. Here's my code for that.

Dim oSegments As ObjectCollection
Set oSegments = ThisApplication.TransientObjects.CreateObjectCollection
Dim oSketchEnt As SketchEntity
For Each oSketchEnt In oSketch.SketchEntities
If Not oSketchEnt.Construction And Not TypeOf oSketchEnt Is
SketchPoint Then
oSegments.Add oSketchEnt
End If
Next

' Create a profile.
Set oProfile = oSketch.Profiles.AddForSolid(False, oSegments)

The second is to go ahead and create the profile and then edit it by
deleting the path(s) in the profile that are defined by text boxes.

' Create a profile.
Set oProfile = oSketch.Profiles.AddForSolid(True)

' Find any paths created by text boxes. This finds them first and then
' deletes them because otherwise its difficult to itterate through the
' collection while you modify it by deleting items.
Dim textPaths As New Collection
Dim oPath As ProfilePath
For Each oPath In oProfile
If Not oPath.TextBox Is Nothing Then
textPaths.Add oPath
End If
Next

' Delete the paths with text.
Dim i As Integer
For i = 1 To textPaths.Count
Set oPath = textPaths.Item(i)
oPath.Delete
Next

--
Brian Ekins
Autodesk Inventor API
0 Likes
Message 5 of 7

robmatthews
Collaborator
Collaborator

I'm looking for the reciprocal to this. I want to Extrude-Cut some text.  I have programmatically created a sketch on an origin plane, and created the text, but I am having trouble identifying that text as a profile.

 

I would have thought that the following would be sufficient, but I get "Invalid Procedure call or Arguement".

 

The only thing in the sketch is the text that I want to extrude.

 

Dim oSegments As ObjectCollection
Set oSegments = IVApp.TransientObjects.CreateObjectCollection
Dim oSketchEnt As SketchEntity
For Each oSketchEnt In oSketch.SketchEntities
    oSegments.Add oSketchEnt
Next
' Create a profile.
Set oProfile = oSketch.Profiles.AddForSolid(True, oSegments)
Set oExtrude = oCompDef.Features.ExtrudeFeatures.AddByDistanceExtent(oProfile, "Thickness", kNegativeExtentDirection, kNegativeExtentDirection)

 

 

=============================================
This is my signature, not part of my post.
0 Likes
Message 6 of 7

xiaodong_liang
Autodesk Support
Autodesk Support

Hi,

 

here is a blog on how to extrude a text. Probably it helps you to figure out the problem at your side?

 

http://adndevblog.typepad.com/manufacturing/2012/08/extrude-the-text-in-inventor.html

Message 7 of 7

robmatthews
Collaborator
Collaborator

Perfect, Thank you.

 

It seems my problem was that I wasn't fully specifying the constants. That is, instead of

 

PartFeatureExtentDirectionEnum.kPositiveExtentDirection

and PartFeatureOperationEnum.kJoinOperation

 

 

I was just using the kPositiveExtentDirection and kJoinOperation by themselves.

 

Again, Thank you.

 

=============================================
This is my signature, not part of my post.
0 Likes