Change Extrude direction after redifine

Change Extrude direction after redifine

mechielvanvalen
Enthusiast Enthusiast
952 Views
4 Replies
Message 1 of 5

Change Extrude direction after redifine

mechielvanvalen
Enthusiast
Enthusiast

Hi,

We make features with iLogic (rectangles, circles and triangles).

The iLogic rule makes a new offset workplane from the original XY, XZ and YZ workplane. The triangles are given an orientation user parameter: XY = Z, XZ = Y and YZ = X. The extrudes of the XY and YZ are both positive and the XZ is negative.

 

With the Rule we can redefine the offset workplanes based on the Orientation Z, Y or X.
When the orientation of Z or X is changed to Y in the user parameters the extrude must become Negative and for the Y to Z or X must become positive. We already have a rule that is almost right. The only problem is that we  cannot agree to change the kNegativeExtentDirection to kPositiveExtentDirection. Does anybody know what is going wrong with our Rule?

Accepted solutions (1)
953 Views
4 Replies
Replies (4)
Message 2 of 5

machiel.veldkamp
Collaborator
Collaborator

Normally if you make a new extrusion you can use

 

oExtrudeDef.SetDistanceExtent(10, kNegativeExtentDirection)

kNegativeExtentDirection or kPositiveExtentDirection  in that case.

 

However, I don't know how to change it when there is already an existing Extrusion.

 

Hmmmm...

 

Anyone else?

Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.

___________________________
0 Likes
Message 3 of 5

WCrihfield
Mentor
Mentor

Perhaps, since you are planning on reversing the directions of your extrude features, it would be better to extrude To a WorkPlane, instead of Distance.  Then you go back in to flip the direction of the feature, you can just use the oExtrudeDef.SetToExtent(oWorkPlane) to specify an alternate plane on the other side of the sketch plane.

Similar to this:

In my test part, I created two offset work planes.  On positive 6 inches and one negative 6 inches from my origin plane.  I created my simple rectangle sketch on that origin plane, then extruded it up to the offset work plane on the positive side.  Then when I run this code, it flips the extrude feature to use the other plane as its To extent.

Dim oPDoc As PartDocument = ThisApplication.ActiveDocument
Dim oPDef As PartComponentDefinition = oPDoc.ComponentDefinition
Dim oExtFeats As ExtrudeFeatures = oPDef.Features.ExtrudeFeatures
Dim oExtFeat As ExtrudeFeature = oExtFeats.Item(1)
Dim oExtDef As ExtrudeDefinition = oExtFeat.Definition
oExtDef.SetToExtent(oPDef.WorkPlanes.Item("Bottom Plane")) ' currently to "Top Plane"

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 4 of 5

JhoelForshav
Mentor
Mentor
Accepted solution

Hi @mechielvanvalen 

See this example of how to flip the extent direction:

Dim oExtrude As ExtrudeFeature = ThisDoc.Document.ComponentDefinition.Features.ExtrudeFeatures(1)
oExtrude.Definition.SetDistanceExtent(oExtrude.Extent.Distance.Expression, _
PartFeatureExtentDirectionEnum.kNegativeExtentDirection)'Or PartFeatureExtentDirectionEnum.kPositiveExtentDirection
Message 5 of 5

mechielvanvalen
Enthusiast
Enthusiast

Thanx Jhoel it works!

0 Likes