VBA existing joint info

VBA existing joint info

peter.ensing
Enthusiast Enthusiast
498 Views
5 Replies
Message 1 of 6

VBA existing joint info

peter.ensing
Enthusiast
Enthusiast

Hello all!

 

I'm wondering if there is a way to get the info of an existing rigid joint.

I have a subassembly (with a part that contains a named face "Jointface") that is connected, to an edge of a hole, with a rigid joint.

If I replace the part inside the subassembly with a similar part the rigid joint will fail on the named face or face its connected to. So I guess the face needs to be repointed.

But I dont want to bother the user with that.

Can I edit the rigid joint and re-appoint the namedface through VBA?

Or store the edge its already connected to and rebuild the rigid joint with that info?

 

Thanks in advance and kind regards,

Peter

 

0 Likes
499 Views
5 Replies
Replies (5)
Message 2 of 6

WCrihfield
Mentor
Mentor

Replacing parts in an assembly, and maintaining their constraints & joints is tricky business.  If both parts were created from the same source file, and both had the same face, then they would likely keep their constraints.  But that is usually not the case.  Perhaps using iMates would hold-up better when panning on routinely replacing the part.

Each face, edge, and entity with in a design, has unique identifiers.  Even if you created two identical parts sequentially from scratch, using the same template file, the corresponding faces are identified differently, so it knows one is not the other.

When you give a face a name, you are basically assigning an Attribute to that face.  You may be able to use the AttrubuteManager's FindObjects function to identify the face of the other part if it has the same name though.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 3 of 6

peter.ensing
Enthusiast
Enthusiast

Thanks for your reply!

The replacing part can be ignored for what I'm searching for.

A existing constrain or joint contains info (edge, point or face)  of 2 parts.

Can this info be adressed back to VBA so it can be used for something else again?

For example:

A joint with a face midpoint and a circular edge center.
I want to retrieve and store this circular edge information from the joint to be able to reuse for a new joint made via VBA. Is this possible?

0 Likes
Message 4 of 6

WCrihfield
Mentor
Mentor

The key to passing most things between iLogic and VBA is usually a NameValueMap.

I don't know how familiar you are with them.  They're fairly simple.  A NameValueMap, basically can contain a list of pairs.  Each pair has a Name and a Value.  They can be passed back and forth because they stay in 'session memory', and are TransientObjects.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 5 of 6

peter.ensing
Enthusiast
Enthusiast

Thanks for your reply. I'm not familiar with NameValueMap yet, so I'll do some research.
When I have time to continu coding I'll let you know if it worked out or not.

0 Likes
Message 6 of 6

WCrihfield
Mentor
Mentor

Here is a simple test to help you learn about them.

Create two external iLogic rules.  First rule is named "NameValueMap 1".  Second Rule is named "NameValueMap 2".

Copy & paste the following code into the rule named "NameValueMap 1"

 

'Create a NameValueMap
Dim oMap As NameValueMap = ThisApplication.TransientObjects.CreateNameValueMap
'Add a Name / Value pair into it.
oMap.Add("TestName", "TestValue")
'Run your second rule here.
iLogicVb.RunExternalRule("NameValueMap 2", oMap)
'This is where you get the other Value back from the second rule.
MsgBox("First Rule - Value returned from second rule = " & oMap.Value("Return"))

 

'Now copy the following contents into the rule named "NameValueMap 2".

 

'Retrieve NameValue Pair from calling rule
'Arguments is a NameValueMap
Dim oRecivedValue As String = RuleArguments.Arguments.Value("TestName")
'This next line is just prooving that this rule recieved what you sent to it.
'You can delete it when you've learned the trick.
MsgBox("Second Rule - Recieved Pair Value = " & oRecivedValue)
'Do something with the oRecieved Value

'Now establish the value you want to send back to the Calling Rule.
Dim oValueToSendBack As String = "It Worked!"
'Return a new Value to the Calling Rule
RuleArguments.Arguments.Value("Return") = oValueToSendBack

 

I hope this helps.
If this solves your problem, or answers your questions, please click 'Accept As Solution".
Or, if this helps you reach your goal, please click 'LIKES" 👍.

 

Also, if you're interested, here are a few of the 'Ideas' I'd like to get implemented.
If you agree with any of them, please vote for them.

  • Add more capabilities to the 'Customize' dialog box (exe. Add Tab & Add Panel) Click Here
  • MessageBox, InputBox, and InputListBox Size & Format Options Click Here
  • Constrain & Dimension Images In Assembly Sketches & Drawing Sketches (TitleBlocks & SketchedSymbols) Click Here
  • Save Section View Status In DesignViewRepresentation (So It Can Be Used In The Drawing) Click Here
  • Add SolidBodies Folder In iLogic Rule Editor Model Tab Click Here
  • Convert All Views To Raster Before Autosave Stores To 'OldVersions' Folder Click Here
  • SetDesignViewRepresentation - Fix limitations for DrawingView of a Part Click Here
  • Create DocumentSubTypeEnum Click Here

Inventor 2020 Help | Inventor Forum | Inventor Customization Forum | Inventor Ideas Forum

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes