Inventor API : How to find sketch fully constrained using VB.net

Inventor API : How to find sketch fully constrained using VB.net

umesh.mhaskar
Contributor Contributor
1,019 Views
4 Replies
Message 1 of 5

Inventor API : How to find sketch fully constrained using VB.net

umesh.mhaskar
Contributor
Contributor

Hello Everyone,

                         While working with Inventor API sketches i am not geting right constrain status with below process:   

         

                       e.g. 1)  create new part

                              2)  create sketch1 and give required dimentions for fully constrained. now sketch1 is fully constrained , Extrude sketch1.

                              3)  create sketch2 with reference sketch1 face and use fix constrain option for fully constrained. now sketch2 is fully constrained. Extrude Skecth 2

                              4)  create sketch3 with with reference sketch1 face  and give required dimentions for fully constrained. now sketch3 is fully constrained.

                

                               When we finding above sketches constraining status using vb.net & inventor API its gives result for constrain status as below:

 

                Sketch1 = kFullyConstrainedConstraintStatus

                Sketch2 = kUnknownConstraintStatus 

                Sketch3 = kUnknownConstraintStatus

 

Problem: Sketch2 & Sketch3 is gives kUnknownConstraintStatus result insted of kFullyConstrainedConstraintStatus.

  

Then is any another option in APi to get extact constraining status.

 

Regards,

Umesh

 

0 Likes
1,020 Views
4 Replies
Replies (4)
Message 2 of 5

Maxim-CADman77
Advisor
Advisor

I'd like to up this pretty old thread.
Have just faced impossibility to get true ConstraintStatus for Sketch named "Slice" in "Upper - Front.ipt" (Component of the Stapler legacy sample available at https://www.autodesk.com/support/technical/article/caas/tsarticles/ts/3gnm93P9sPAWE6vndk7fjq.html).

API of Autodesk Inventor 2024 (and 2023.2.1) returns 51716 (kUnknownConstraintStatus) while Inventor knows there 6 constraints needed if the sketch is opened for edit (so API should return kUnderConstrainedConstraintStatus).

 

PS:

Autodesk knows about this issue (https://www.autodesk.com/support/technical/article/caas/sfdcarticles/sfdcarticles/ConstraintStatus-f...but issue is still actual.

Please vote for Inventor-Idea Text Search within Option Names

0 Likes
Message 3 of 5

Curtis_Waguespack
Consultant
Consultant
0 Likes
Message 4 of 5

Maxim-CADman77
Advisor
Advisor

Thank you for sharing the link...

I believe marking that thread as solved was a mistake thus I prefer to keep discuss the issue here.

 

Some more related info:

Here is my simplest iLogic code to reproduce the issue on the sample .IPT I've mentioned in previous message:

 

 

 

Option Explicit On

Dim oPartDoc As PartDocument = ThisDoc.Document
Dim oPCD As ComponentDefinition = oPartDoc.ComponentDefinition
For Each oSk in oPCD.Sketches
	logger.info(oSk.Name & " - " & [Enum].GetName(GetType(ConstraintStatusEnum), oSk.ConstraintStatus))
Next

 

 

 


I would take this Issue for known-but-not-solved-yet-API-issue if Design Checker Add-In (with default settings) won't get things right.

Sketch-ConstraintStatus-Issue.png

From this picture you can see that Design Checker reports the "Slice" sketch "faulty" (UnderConstrained) while my iLogic code gets the Unknown ConstraintStatus value.

PS:

I kindly hope @MjDeck or @YuhanZhang will look at this and probably comment this somehow.

Please vote for Inventor-Idea Text Search within Option Names

0 Likes
Message 5 of 5

YuhanZhang
Autodesk
Autodesk

Hi @Maxim-CADman77 

 

The sketch "Slice" in the legacy data is a derived sketch, so it should be in fully constrained status, but in UI it still indicates it needs dimensions, so I logged this as INVGEN-68532. You can provide the number to query its status.



If this solves the problem please click ACCEPT SOLUTION so other people can find it easily.



Rocky Zhang
Inventor API PD
Manufacturing Solutions
Autodesk, Inc.

0 Likes