Sketch Fully constrained or not using API

Sketch Fully constrained or not using API

Anonymous
Not applicable
1,123 Views
3 Replies
Message 1 of 4

Sketch Fully constrained or not using API

Anonymous
Not applicable

Hi everyone,

 

I have a model in which I need to check only to options using API.

1. Sketch Fully Constrained

2. Sketch Fully not Constrained.

 

I did the programming but I got "Unknown Constrained" when my sketch is fully constrained also.

How do I fix this problem?

How do I only know whether the sketch is constrained or not?

 

 

 I have attached my model in which sketch 3, 4 and 8 is not fully constrained and remaining sketches are fully constrained.

I want this information using API.

 

Please  suggest me.

 

Regards.

 

0 Likes
Accepted solutions (1)
1,124 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable
Accepted solution

Hi everyone,

 

I solved this problem myself. 🙂 

Since I saw many posts regarding this problem.

I thought it might be helpful for those people facing the same issues.

 

Here is my code which shows the sketch is fully constrained or not.

 

private void checkFullyConstrained( PlanarSketch oSketch1)
{

           oSketch1.Edit();
           ObjectCollection oSketchObjects =objInventorOperation.mInventorApp.TransientObjects.CreateObjectCollection();
          foreach (SketchEntity oSketchEntity in objInventorOperation.oSketch1.SketchEntities)
          {

                 if (oSketchEntity._GeometryMoveableStatus != GeometryMoveableStatusEnum.kFixedGeometryMoveableStatus)   //this is the main code
                {
                        if (oSketchEntity.ConstraintStatus != ConstraintStatusEnum.kFullyConstrainedConstraintStatus)
                        {     oSketchObjects.Add(oSketchEntity); }

                       if (oSketchObjects.Count > 0)
                      {  MessageBox.Show(oSketch1.Name + " Not Fully Constrained"); break; }
                      else
                     {  MessageBox.Show(oSketch1.Name + " Fully Constrained"); break;  }
                }

        }

       oSketch1.ExitEdit();

}

 

Hope this might help you all. 🙂

Regards.

 

Message 3 of 4

Anonymous
Not applicable

Hi,

 

interesting but can you explain how to use it ?

since i'm a total noob on this i wonder how to use it.

0 Likes
Message 4 of 4

Anonymous
Not applicable

Hi,

 

I am sorry, I didn't understand your question?

Could you please explain me in detail where and how you are trying to use it?

 

Regards.

 

0 Likes