Jump to content

How to add Polyline with fillet edges to block in VBA?


Rojek

Recommended Posts

What I wonna do is to pick a polyline on screen then fillet it's edges and add it to block. I find out how to fillet edges but I don't know how to add it to block with fillet edges:/

 

 

Public Sub bar()
'Checking for existing blocks
Dim objBlock As AcadBlock
Dim strBlockList As String
Dim n As Integer
   n = -3
   strBlockList = "List of blocks: "
For Each objBlock In ThisDrawing.Blocks
   n = n + 1
   strBlockList = strBlockList & vbCr & objBlock.Name
Next
   MsgBox strBlockList
  ' MsgBox n

'**********copied from [url="http://www.cadtutor.net/forum/member.php?u=210"]fixo[/url]
'FILLET

Dim oPline As AcadLWPolyline
Dim varPt As Variant

On Error GoTo Error_Trapp
ThisDrawing.Utility.GetEntity oPline, varPt, "Select polyline"
If Err Then
Err.Clear
Exit Sub
ElseIf Not TypeOf oPline Is AcadLWPolyline Then
MsgBox "This is not a LightWeightPolyline"
Else
Dim filrad As Double
filrad = 10 ' CDbl(InputBox(vbCr & vbCr & "Specify fillet radii: ", "Filleting LWPolyline", "10,0"))
ThisDrawing.SetVariable "FILLETRAD", filrad
Dim commStr As String
commStr = "_FILLET _P " & _
"(handent " & Chr(34) & oPline.Handle & Chr(34) & ")" & vbCr ' I have to admit I don't understand this row
ThisDrawing.SendCommand commStr
End If

Error_Trapp:
If Err.Number = 13 Then
MsgBox "This is not a polyline" & vbCr _
& "Error number: " & Err.Number & vbCr & Err.Description
End If
'''*********^^^THIS IS NOT MINE. I've copied it form some board and it works


'adding LWPolyline to block
Dim Cordinat As Variant
   Cordinat = oPline.Coordinates
Dim indeks As Integer
Dim UpperBoundery As Integer
Dim LowerBoundery As Integer
UpperBoundery = UBound(Cordinat)
LowerBoundery = LBound(Cordinat)


Do
   If l > UpperBoundery Then
       Exit Do
   End If

'MsgBox Cordinat(l)
l = l + 1
Loop

Dim objBlockName As String
Dim dblOrigin(2) As Double

objBlockName = "bar" & n

   
Set objBlock = ThisDrawing.Blocks.Add(varPt, objBlockName) 
   objBlock.AddLightWeightPolyline Cordinat
  

End Sub

Link to comment
Share on other sites

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...