Rojek Posted January 3, 2010 Share Posted January 3, 2010 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 Quote Link to comment Share on other sites More sharing options...
cadman2009 Posted January 4, 2010 Share Posted January 4, 2010 Hi dear Rojek Please go to this link and download your desired tool : http://www.visiblevisual.com/index.php/AutoCad-VB/VBA/database-driven-block-manager.html happy Xmas and have a nice day Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.