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: 

Change direction of Hole

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
rikard.nilsson
619 Views, 2 Replies

Change direction of Hole

 

Hi,

 

I'm trying to find out how to change a direction of a hole.

 

Doeas anybody have an idea why this code wont work on holes?

 

Dim pdoc As PartDocument = ThisDoc.Document
Dim pdef As PartComponentDefinition = pdoc.ComponentDefinition
Dim hfea As HoleFeature = pdef.Features.Item("Hole1")

  Dim extent As DistanceExtent = TryCast(hfea.Extent, DistanceExtent)
  If extent.Direction = PartFeatureExtentDirectionEnum.kPositiveExtentDirection Then
     extent.Direction = PartFeatureExtentDirectionEnum.kNegativeExtentDirection
  ElseIf extent.Direction = PartFeatureExtentDirectionEnum.kNegativeExtentDirection Then
     extent.Direction = PartFeatureExtentDirectionEnum.kPositiveExtentDirection
  End If

 Regards

Rikard

2 REPLIES 2
Message 2 of 3
JaneFan
in reply to: rikard.nilsson

Hey @rikard.nilsson , 

 

Please use different set method to change different type extent, code like this: 

Dim pdoc As PartDocument = ThisDoc.Document
Dim pdef As PartComponentDefinition = pdoc.ComponentDefinition
Dim hfea As HoleFeature = pdef.Features.Item("Hole1")

  Dim extent As DistanceExtent = TryCast(hfea.Extent, DistanceExtent)
  If extent.Direction = PartFeatureExtentDirectionEnum.kPositiveExtentDirection Then
	  hfea.SetDistanceExtent(hfea.Depth, PartFeatureExtentDirectionEnum.kNegativeExtentDirection )
'     extent.Direction = PartFeatureExtentDirectionEnum.kNegativeExtentDirection
  ElseIf extent.Direction = PartFeatureExtentDirectionEnum.kNegativeExtentDirection Then
	  hfea.SetDistanceExtent(hfea.Depth, PartFeatureExtentDirectionEnum.kPositiveExtentDirection )
'     extent.Direction = PartFeatureExtentDirectionEnum.kPositiveExtentDirection
  End If

 




Jane Fan
Inventor QA Engineer
Message 3 of 3
solomon_14
in reply to: JaneFan

This gives me an error saying "Expected: = "

 

Any help please.

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

Post to forums  

Autodesk Design & Make Report