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: 

AddForSolid - Exclude Text

6 REPLIES 6
Reply
Message 1 of 7
Anonymous
521 Views, 6 Replies

AddForSolid - Exclude Text

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?
6 REPLIES 6
Message 2 of 7
Anonymous
in reply to: Anonymous

Never mind..."Combine" parameter was set to true.
Message 3 of 7
Anonymous
in reply to: Anonymous

Actually...that did not help either. Same issue. I can't exclude text from the extrude command.
Message 4 of 7
Anonymous
in reply to: Anonymous

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
Message 5 of 7
robmatthews
in reply to: Anonymous

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.
Message 6 of 7
xiaodong_liang
in reply to: Anonymous

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

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.

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

Post to forums  

Autodesk Design & Make Report