Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

Coincident constrain between sketch block point and grounded point/projected point

taher.basha
Enthusiast

Coincident constrain between sketch block point and grounded point/projected point

taher.basha
Enthusiast
Enthusiast

Hi,

 

I am trying to create Coincident constrain between sketch block insertion point and grounded/projected point

 

I have tried with the below code:

 

TransientGeometry tg = invApp.TransientGeometry;
PartDocument pd = invApp.ActiveDocument as PartDocument;
PartComponentDefinition pcd = pd.ComponentDefinition;
PlanarSketch sk = pcd.Sketches["Sketch1"];
SketchBlock sb = sk.SketchBlocks[1];
SketchPoint pt = sb.Definition.InsertionPoint;

SketchEntity cpt = sk.AddByProjectingEntity(pcd.WorkPoints[1]);

sk.GeometricConstraints.AddCoincident((SketchEntity)pt, cpt);

 

 

 

 

coincident.PNG

0 Likes
Reply
Accepted solutions (1)
241 Views
1 Reply
Reply (1)

dalton98
Collaborator
Collaborator
Accepted solution

Hello. You need to get the sketch point object from the sketch block. Example 

 

You will need to convert this from vb.net

Dim tg As TransientGeometry = ThisApplication.TransientGeometry
Dim pd As PartDocument = ThisApplication.ActiveDocument
Dim pcd As PartComponentDefinition = pd.ComponentDefinition
Dim sk As PlanarSketch = pcd.Sketches.Item("Sketch1")
Dim sb As SketchBlock = sk.SketchBlocks(1)
Dim pt As SketchPoint = sb.Definition.InsertionPoint
Dim cpt As SketchEntity = sk.AddByProjectingEntity(pcd.WorkPoints(1))
Dim pt1 As SketchPoint = sb.GetObject(pt)
sk.GeometricConstraints.AddCoincident(pt1, cpt)