Move EOP (End of Part) down just one feature using VBA.

Move EOP (End of Part) down just one feature using VBA.

shastu
Advisor Advisor
1,063 Views
6 Replies
Message 1 of 7

Move EOP (End of Part) down just one feature using VBA.

shastu
Advisor
Advisor

Is there a way to just move the (End of Part) down one feature regardless of where it is in the browser using VBA?  I already know how to move it all the way to the top, but can't figure out how to get it to move down one feature from where it is currently located regardless of the type of feature that it is?  Seems like it should be simple, but I can't figure it out.

0 Likes
Accepted solutions (1)
1,064 Views
6 Replies
Replies (6)
Message 2 of 7

WCrihfield
Mentor
Mentor

It looks like this in regular iLogic.

Dim oDoc As PartDocument = ThisApplication.ActiveDocument
Dim oDef As PartComponentDefinition = oDoc.ComponentDefinition
Dim oAfter As PartFeature
Dim oBefore As PartFeature
oDef.GetEndOfPartPosition(oAfter, oBefore)
oAfter.SetEndOfPart(False)

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 3 of 7

shastu
Advisor
Advisor

Thanks, but I was looking for a solution in VBA.  I tried to modify it for VBA but I don't know how to modify the last two lines.  Not sure if the fourth line down is correct either.

 

Dim oDoc As PartDocument
Set oDoc = ThisApplication.ActiveDocument
Dim oDef As PartComponentDefinition
Set PartComponentDefinition = oDoc.ComponentDefinition
Dim oAfter As PartFeature
Dim oBefore As PartFeature
oDef.GetEndOfPartPosition(oAfter, oBefore)
oAfter.SetEndOfPart (False)

 

0 Likes
Message 4 of 7

WCrihfield
Mentor
Mentor
Accepted solution

Here is the VBA version.

Public Sub Move_EOP_Down_1()
    Dim oDoc As PartDocument
    Set oDoc = ThisApplication.ActiveDocument
    Dim oDef As PartComponentDefinition
    Set oDef = oDoc.ComponentDefinition
    Dim oAfter As Object
    Dim oBefore As Object
    oDef.GetEndOfPartPosition oAfter, oBefore
    oBefore.SetEndOfPart (False)
End Sub

To move the EOP down run it like shown.

To move the EOP up, switch the last line to:

oAfter.SetEndOfPart(True)

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 5 of 7

shastu
Advisor
Advisor

Thanks so much.  I hate not being able to figure this out on my own.  How did you know what to change?

0 Likes
Message 6 of 7

WCrihfield
Mentor
Mentor

Glad to have been of some service.

Just trial, error, researching other similar sounding posts, repeat...

I'm not as familiar with VBA as I am with iLogic, but it's not that bad to pick up as needed when we've got a great forum like this to reference.

Good luck in your future Inventor Customization pursuits. 🙂

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 7 of 7

shastu
Advisor
Advisor

Thanks for your help.  It is greatly appreciated.

0 Likes