Jump to content

Recommended Posts

Posted

how can use hatch command from vb6

i am drawing from vb6 on autocad but i need to fill some area by hach but i do not know how can use it

any body can help me please

Posted

Here is one based on Help file example

Hope it will give you some idea

 

' borrowed from the Help file
Public Function DrawHatch(intPt As Variant, hatLayer As String, patName As String, patType As Long, blnAssoc As Boolean, _
hatScale As Double, hatAngle As Double, hatCol As Integer) As AcadHatch
' This example creates an associative hatch in model space.
Dim hatchObj As AcadHatch
On Error GoTo Err_Control
' Create the associative Hatch object in model space
Set hatchObj = ThisDrawing.ModelSpace.AddHatch(patType, patName, blnAssoc)
' add properties
hatchObj.Layer = hatLayer
hatchObj.AssociativeHatch = blnAssoc
hatchObj.PatternScale = hatScale
hatchObj.PatternAngle = hatAngle
hatchObj.color = hatCol
' Create the outer boundary for the hatch
Dim ObjLast As AcadEntity
Dim i As Integer
'Dim intPt As Variant
Dim pstr As String
Dim outerLoop(0) As AcadEntity
i = ThisDrawing.ModelSpace.Count - 1
'intPt = ThisDrawing.Utility.GetPoint(, "Pick the inner point of boundary")
pstr = Replace(CStr(intPt(0)), ",", ".") & "," & Replace(CStr(intPt(1)), ",", ".")
ThisDrawing.SendCommand Chr(3) & Chr(3) & "-boundary" & vbCr & pstr & vbCr & vbCr
Set ObjLast = ThisDrawing.ModelSpace.Item(i + 1)
Set outerLoop(0) = ObjLast
' Append the outerboundary to the hatch object, and display the hatch
hatchObj.AppendOuterLoop (outerLoop)
hatchObj.Evaluate
' delete boundary
ObjLast.Delete
ThisDrawing.Regen True
Set DrawHatch = hatchObj
Err_Control:
End Function

 

~'J'~

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...