Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error while using "AddBiEltCst" method of CATIA 3D Assembly Constraint

Status
Not open for further replies.

Charlie_

Mechanical
Feb 25, 2020
2
IN
Hello All,

I am trying to use the method of "AddBiEltCst" to constrain a point in one part to a point in another part in same assembly.
Please see the attached pic as to what my requirement is and what the error i am facing.

Query_ugk2zz.png

I have tried the following to correct the error

1. Early binding objects
2. Late binding objects
3. Tried all the four CreateReferenceFromGeometry, CreateReferenceFromBrepNames, CreateReferenceFromObject, CreateReferenceFromName to create references.


Please see the snippet and suggest me a solution

''''''''''''''''' *Code Snippet Starts*'''''''''''''''''''''''''
'
'
' Rest of the Codes Here (If needed please ask)
'
'

Dim PointRefOnPart As Reference
Set PointRefOnPart = CorrespondingPart.CreateReferenceFromObject(pointhybshape)

Dim PointRefOnPanel As Reference
Set PointRefOnPanel = CorrespondingPanelPart.CreateReferenceFromObject(ArrayToHoldLinesPoints(j - 1, 0))'''''' This is inside a for loop hence the index j

Dim FirstConstraint As Constraint
Set FirstConstraint = oConstraints.AddBiEltCst (catCstTypeOn, PointRefOnPart, PointRefOnPanel)'''''Fails at this line.Error message reads The method AddBiEltCst of object constraints failed

RootProduct.Update'

'
'
''''''''''''''''' *Code Snippet Ends*'''''''''''''''''''''''''



' other relevant info

Dim pointhybshape
Set pointhybshape = bhybridShapes.Item("SnapPoint")'''''''''''''''''''(pointhybshape is the hybridpoint)

Set ArrayToHoldLinesPoints(i - 1, 0) = ohybridShapes.Item(i)''''''''''(This Array holds hybridpoints from geosets)
 
Replies continue below

Recommended for you

Hello,
Do you need to constraint point to point?

I use the Axis system to Axis system for example.

Will this go as selection, like some sort search for the specified name or hardcoded point names?

Capture_bbtc57.png


You can see something similar on this macro on the pic.

In my case, I have the option for hardcoded name "Absolute Axis system" but also I can use selection to use another name.
For second I use selection to select the axis. This is a little bit different but can adjust to your problem.

Check more cool macros catiavbmacro.com
 
Hello,

Thanks for replying. I do have the option to either go with hard coded names or selection. That part is already dealt with.
My problem is with the method of "CreateReferenceFromObject" to create reference for constraining the parts.
Eventually i could get it work with the "CreateReferenceFromName" method but i would like to understand why the former method failed.
To be specific, please see the code below


****************Code Snippet Starts***************************

1. Dim PointRefOnPart As Reference
2. Set PointRefOnPart = CorrespondingPart.CreateReferenceFromObject(pointhybshape)

3. Dim PointRefOnPanel As Reference
4. Set PointRefOnPanel = CorrespondingPanelPart.CreateReferenceFromObject(ArrayToHoldLinesPoints(j - 1, 0))

5. Dim FirstConstraint As Constraint
6. Set FirstConstraint = oConstraints.AddBiEltCst (catCstTypeOn, PointRefOnPart, PointRefOnPanel)

'This code fails to set the constraint, but i could get this work when references were created using "CreateReferenceFromName" method

****************Code Snippet Ends***************************


Other Points to be noted:
Active document is a product document
pointhybshape is a hybridpoint (an object)
ArrayToHoldLinesPoints is an array that holds hybridpoints (an object)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top