Message 1 of 3

Not applicable
10-22-2019
07:49 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi i am trying to automate a sketch with ilogic.
Now i already got to draw the circles but now i want to constrain them.
Somehow i cannot constrain the two centerpoint of two circles together.
i dont need them to merge or anything, they just need to be in the same place.
imports system.IO Dim Def As PartComponentDefinition = ThisDoc.Document.Componentdefinition Dim plane As WorkPlane Dim i As Integer =-2 For Each plane In Def.WorkPlanes i = i + 1 Next Dim WPlane As WorkPlane = Def.WorkPlanes.AddByPlaneAndOffset(Def.WorkPlanes("YZ plane"), (60.3 / 20) + 0.2) WPlane.Name = "Plane " & i Dim oSketch As Sketch = Def.Sketches.Add(WPlane) oSketch.Name = "Hole " & i oSketch.Edit Dim oTG As TransientGeometry = ThisApplication.TransientGeometry 'create base point at 0,0 Dim Bp As SketchPoint = oSketch.SketchPoints.Add(oTG.CreatePoint2d(0, 0)) 'create circle insertionpoint Dim Cp As Point2d = oTG.CreatePoint2d(5, 0) 'project origin point 'Dim Origin As SketchPoint = oSketch.AddByProjectingEntity(def.WorkPoints.Item(1)) 'create first circle Dim oCircle As SketchCircle oCircle = oSketch.SketchCircles.AddByCenterRadius(Cp, (13.2 / 10)) 'create second circle Dim oCircle1 As SketchCircle oCircle = oSketch.SketchCircles.AddByCenterRadius(oCircle.CenterSketchPoint, ((13.2-2) / 10)) Dim Constraints As GeometricConstraints = oSketch.GeometricConstraints Trace.WriteLine("Ground Bp") 'constriant base point Constraints.AddGround(Bp) Trace.WriteLine("horizontal") 'constraint first circle horizontal to base point Constraints.AddHorizontalAlign(Bp, oCircle.CenterSketchPoint) Trace.WriteLine("coincident") 'oCircle1.CenterSketchPoint.Merge(oCircle.CenterSketchPoint) Constraints.AddCoincident(oCircle.CenterSketchPoint, oCircle1.CenterSketchPoint) Trace.WriteLine("End code")
Also i found out i cannot do 'addhorizontalalign' with a sketchpoint and a projected point with iloigc, which does work when you do it by hand.
Does anyone know restrictions or tips when using constraints with ilogic?
Kind regards,
Geert
Solved! Go to Solution.