Message 1 of 4
Sketch creation flips Coordinate System
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am trying to write some iLogic that will create a sketch based on some user input and insert a circle (and eventually a linear pattern of said circle) but when I try to specify the point at which I want the circle to be placed it flips the coordinate system and places the circle outside of the part. I've searched and cannot seem to find how to fix this issue. Here is the code I have, please be gentle....I am not a programmer so I am fumbling thru while trying to learn.
Dim oPartDoc As Document = ThisDoc.Document Dim oPartCompDef As PartComponentDefinition = ThisApplication.ActiveDocument.ComponentDefinition Dim oTG As TransientGeometry = ThisApplication.TransientGeometry 'get measurements to determine Material Thickness My_x = Measure.ExtentsLength My_y = Measure.ExtentsWidth My_z = Measure.ExtentsHeight 'Make longest value the Length, rounded to 2 places Thickness = Round(MinOfMany(My_x, My_y, My_z), 4) If oPartDoc.DocumentType = kPartDocumentObject Then Dim oParams As Parameters = oPartCompDef.Parameters Dim oUserParams As UserParameters = oParams.UserParameters Try oHoleSizes = oUserParams.Item("HoleSizes") Catch oInsulationType = oUserParams.AddByValue("HoleSizes", 0, kInchLengthUnits) MultiValue.SetList("HoleSizes", .109375, .125, .15625, .1875, .21875, .28125) End Try Try oMaterial = oUserParams.Item("Material") Catch oInsulationType = oUserParams.AddByValue("Material", " ", kTextUnits) MultiValue.SetList("Material", "Starboard", "Acrylic", "Proboard") End Try Try oHoleType = oUserParams.Item("HoleType") Catch oInsulationType = oUserParams.AddByValue("HoleType", " ", kTextUnits) MultiValue.SetList("HoleType", "Pilot", "Thru", "Custom") End Try End If Parameter.Param("HoleSizes").ExposedAsProperty = False Parameter.Param("HoleSizes").IsKey = True Parameter.Param("Material").ExposedAsProperty = False Parameter.Param("Material").IsKey = True Parameter.Param("HoleType").ExposedAsProperty = False Parameter.Param("HoleType").IsKey = True Dim oFace As Face = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kPartFaceFilter, "Select Surface to Place Holes") Dim oFrontEdge As Edge = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kPartEdgeFilter, "Select Front Edge of Pattern") Dim oVertex As Vertex = oFrontEdge.StartVertex Dim oLeftEdge As Edge = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kPartEdgeFilter, "Select Left Edge of Pattern") Dim oRightEdge As Edge = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kPartEdgeFilter, "Select Right Edge of Pattern") oMaterial = InputListBox("Select Material", MultiValue.List("Material"), DrillSizes, Title := "Title", ListName := "List") oHoleSize = InputListBox("Select Hole Type", MultiValue.List("HoleType"), DrillSizes, Title := "Title", ListName := "List") oHoleSize = InputListBox("Select Hole Size", MultiValue.List("HoleSizes"), DrillSizes, Title := "Title", ListName := "List") Dim oSketch As PlanarSketch oSketch = oPartCompDef.Sketches.AddWithOrientation(oFace, oFrontEdge, True, True, oVertex, False) oSketch.Name = "My Oriented Sketch" Dim oCircle As SketchCircle = oSketch.SketchCircles.AddByCenterRadius(oTG.CreatePoint2d(.1, .1), (oHoleSize/2))