UCSIconAtOrigin Example |
Using Programming Languages other than VBA
Sub Example_UCSIconAtOrigin() ' This example toggles the setting of UCSIconAtOrigin. Dim viewportObj As AcadViewport ' Set the viewportObj variable to the activeviewport Set viewportObj = ThisDrawing.ActiveViewport ' Make sure the UCS Icon is on, and a new UCS is defined. ' The new UCS defines the origin for the icon. When the icon ' is not displayed at the origin, it is displayed at the ' lower-left corner of the display. Dim ucsObj As AcadUCS Dim origin(0 To 2) As Double Dim xAxisPoint(0 To 2) As Double Dim yAxisPoint(0 To 2) As Double origin(0) = 2: origin(1) = 2: origin(2) = 0 xAxisPoint(0) = 3: xAxisPoint(1) = 2: xAxisPoint(2) = 0 yAxisPoint(0) = 2: yAxisPoint(1) = 3: yAxisPoint(2) = 0 Set ucsObj = ThisDrawing.UserCoordinateSystems.Add(origin, xAxisPoint, yAxisPoint, "UCS1") ThisDrawing.ActiveUCS = ucsObj viewportObj.UCSIconOn = True ' Display the current setting of UCSIconAtOrigin MsgBox "UCSIconAtOrigin is: " & IIf(viewportObj.UCSIconAtOrigin, "On", "Off"), , "UCSIconAtOrigin Example" ' Toggle the setting of UCSIconAtOrigin viewportObj.UCSIconAtOrigin = Not (viewportObj.UCSIconAtOrigin) ' Reset the active viewport to see the change ThisDrawing.ActiveViewport = viewportObj MsgBox "UCSIconAtOrigin is now: " & IIf(viewportObj.UCSIconAtOrigin, "On", "Off"), , "UCSIconAtOrigin Example" End Sub
Comments? |