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

I wrote a little something something up for you. I forgot a critical component to this function. You need to activate the sketch edit before attempting to create the sketch objects. The Point 2d is outside of this sketch, it can be created whenever, but we must actively be in the sketch to start placing sketch entities. 

 

Run the following code, and you can see how you go about moving the objects around. This is just a funny way to "animate" its movement across the sheet. 

 

Sub main()
	
	Dim oDoc As DrawingDocument = ThisApplication.ActiveDocument
	Dim oTG As TransientGeometry = ThisApplication.TransientGeometry
	
	Dim oSheet As Sheet = oDoc.Sheets.Item(1)
	
	Dim oSketch As DrawingSketch = oSheet.Sketches.Add()
	
	Dim oPoint2d As Point2d = oTG.CreatePoint2d(5, 5)
	
	oSketch.Edit
	
	Dim oSketchPoint As SketchPoint = oSketch.SketchPoints.Add(oPoint2d)
	
	Dim oSketchCircle As SketchCircle = oSketch.SketchCircles.AddByCenterRadius(oSketchPoint, 10 * 2.54)
	'add the constraints to the circle. 
	Dim SketchCirCon As GeometricConstraint = oSketch.GeometricConstraints.AddCoincident(oSketchCircle.CenterSketchPoint, oSketchPoint)
	Dim SketchCirDia As DimensionConstraint = oSketch.DimensionConstraints.AddDiameter(oSketchCircle, oTG.CreatePoint2d(15, 15))
	
	
	
	
	Dim IterationIndex As Integer = 0 
	
	Dim NumberOfOperations As Integer = 10
	
	While IterationIndex <= NumberOfOperations
		oPoint2d.X = oPoint2d.X + 2
		oPoint2d.Y = oPoint2d.Y + 2
		
		oSketchPoint.MoveTo(oPoint2d)
		
		IterationIndex = IterationIndex + 1
		Logger.Info("Iteration: " & IterationIndex)
	oDoc.Update
	End While
		
		
	
	
	oSketch.ExitEdit


	
End Sub

 

A good example of the size stuff I explained before is the size of this circle. It's created as a 10" diameter circle on the sheet, leading to a very large circle. Do the same size circle on the view object, and that circle could be larger or smaller depending on that parts overall size.