GetPolyLineBoundaryLoopData dsHatchBoundaryLoopĮdgesCount = dsHatchBoundaryLoop. Type)ĭebug.Print ("IsPolyline = " & dsHatchBoundaryLoop. GetHatchBoundaryLoop(index) Debug.Print ("Type = " & dsHatchBoundaryLoop. GetBoundaryLoopsCount()ĭebug.Print ("Count of loops = " & loopsCount)ĭebug.Print ("Loop(" & index & "):") 'Get Hatch boundary loopĭim dsHatchBoundaryLoop As DraftSight.HatchBoundaryLoop GetBoundingBox x1, y1, z1, x2, y2, z2ĭebug.Print ("BoundingBox: " & x1 & ", " & y1 & ", " & z1 & ", " & x2 & ", " & y2 & ", " & z2) 'Iterate through Hatch boundary loops Handle)ĭim x1 As Double, y1 As Double, z1 As Doubleĭim x2 As Double, y2 As Double, z2 As DoubleĭsHatch. Erased)ĭebug.Print ("Handle = " & dsHatch. Visible)ĭebug.Print ("Erased = " & dsHatch. Layer)ĭebug.Print ("Visible = " & dsHatch. LineWeight)ĭebug.Print ("Layer = " & dsHatch. LineStyle)ĭebug.Print ("LineWeight = " & dsHatch. LineScale)ĭebug.Print ("LineStyle = " & dsHatch. GetNamedColor)ĭebug.Print ("LineScale = " & dsHatch. Sub PrintHatchParameters(ByVal dsHatch As Hatch)ĭebug.Print ("Hatch parameters:") Debug.Print ("Color = " & dsHatch.Color. MsgBox (entityType & " was selected, but should be Hatch entity.") GetSelectedObject(dsSelectionSetType_e.dsSelectionSetType_Previous, index, entityType) If dsObjectType_e.dsHatchType entityType Then PromptForSelection(singleSelection, prompt, errorMessage) Then 'and get whether selected entity is a Hatch entityĮrrorMessage = "Selected entity is not a Hatch entity." GetCommandMessage 'Prompt user to select a Hatch entity Clear 'Add Hatch entity to the selection filterĭsSelectionFilter. GetSelectionFilter 'Clear selection filterĭsSelectionFilter. GetSelectionManager 'Get selection filter AbortRunningCommand 'Get Selection Manager 'Abort any command currently running in DraftSightĭsApp. MsgBox ("There are no open documents in DraftSight.") Set dsApp = GetObject(, "DraftSight.Application") Option Explicit Dim dsApp As DraftSight.Applicationĭim dsSketchManager As DraftSight.SketchManagerĭim dsSelectionMgr As DraftSight.SelectionManagerĭim dsSelectionFilter As DraftSight.SelectionFilter Sub main() 'Connect to DraftSight The selected entity's Hatch and Hatch boundary loop data is printed ' select an entity, select the entity with the Hatch.
When the prompt appears in the DraftSight command window to ' Ellipse, and apply a Hatch to the entity. Start DraftSight, construct a Circle, Rectangle, Spline, or Add a reference to the DraftSight type library, Copy and paste this example into the Visual Basic IDE.
Create a VBA macro in a software product in which VBA is
This example shows how to get Hatch and Hatch boundary loop data. SetWidth Sets the start and end width of a polyline, given the segment index.Get Hatch and Hatch Boundary Loop Data Example (VBA) SetBulge Sets the bulge of a polyline, given the segment index.
Use the following methods to update the bulge or width of a polyline: AddVertex Adds a vertex to a lightweight polyline. Coordinates property Specifies the coordinates for each vertex in the polyline. Use the following properties and methods to open or close a polyline, change the coordinates of a polyline vertex, or add a vertex: Closed property Opens or closes the polyline. To edit a polyline, use the properties and methods of the LightweightPolyline or Polyline object. A fit polyline uses standard curves for curve fit and utilizes any tangent directions set on any given vertex. Both polylines are controlled by the AutoCAD SPLINETYPE system variable. There are two kinds of spline-fit polylines: quadratic and cubic. A spline-fit polyline uses a curve fit, similar to a B-spline. 2D and 3D polylines, rectangles, polygons, and 3D polygon meshes are all polyline variants and are edited in the same way.ĪutoCAD recognizes both fit polylines and spline-fit polylines.