VBA circles extrusion
VBA circles extrusion
(OP)
Hi,
I'm trying to do a very simple extrusion of two circles.
What am i doing wrong?
Dim circle21, circle22 As AcadCircle
Dim cylinder21, cylinder22 As Acad3DSolid
pt1 = ThisDrawing.Utility.GetPoint(, "Pick insert point:")
D1 = Val(TextBox1.Text)
t1 = Val(TextBox2.Text)
l1 = Val(TextBox3.Text)
D2 = Val(TextBox4.Text)
Set circle21 = ThisDrawing.ModelSpace.AddCircle(pt1, D2 / 2)
Set circle22 = ThisDrawing.ModelSpace.AddCircle(pt1, D2 / 2 - t1)
Set cylinder21 = ThisDrawing.ModelSpace.AddExtrudedSolid(circle21, l1 + D1, 0)
Set cylinder22 = ThisDrawing.ModelSpace.AddExtrudedSolid(circle22, l1 + D1, 0)
Thanks in advance!
I'm trying to do a very simple extrusion of two circles.
What am i doing wrong?
Dim circle21, circle22 As AcadCircle
Dim cylinder21, cylinder22 As Acad3DSolid
pt1 = ThisDrawing.Utility.GetPoint(, "Pick insert point:")
D1 = Val(TextBox1.Text)
t1 = Val(TextBox2.Text)
l1 = Val(TextBox3.Text)
D2 = Val(TextBox4.Text)
Set circle21 = ThisDrawing.ModelSpace.AddCircle(pt1, D2 / 2)
Set circle22 = ThisDrawing.ModelSpace.AddCircle(pt1, D2 / 2 - t1)
Set cylinder21 = ThisDrawing.ModelSpace.AddExtrudedSolid(circle21, l1 + D1, 0)
Set cylinder22 = ThisDrawing.ModelSpace.AddExtrudedSolid(circle22, l1 + D1, 0)
Thanks in advance!
"If you're not part of the solution, you're part of the problem" - John McClane,Die hard
RE: VBA circles extrusion
"If you're not part of the solution, you're part of the problem" - John McClane,Die hard
RE: VBA circles extrusion
RE: VBA circles extrusion
My mistake was that I was trying to do both extrusions at the same time instead of one at a time.. Also I forgot the "region" part..
Here's an easy example of my function so that everone can learn from my mistake:
Dim D1, t1, l1 As Double
Dim circle1, circle2 As AcadCircle
Dim reg1, reg2 As Variant
Dim ent(0) As AcadEntity
Dim cylinder1, cylinder2 As Acad3DSolid
pt1 = ThisDrawing.Utility.GetPoint(, "Pick insert point:")
D1 = Val(TextBox1.Text)
t1 = Val(TextBox2.Text)
l1 = Val(TextBox3.Text)
Set circle1 = ThisDrawing.ModelSpace.AddCircle(pt1, D1 / 2)
Set circle2 = ThisDrawing.ModelSpace.AddCircle(pt1, D1 / 2 - t1)
'First extrusion
Set ent(0) = circle1
reg1 = ThisDrawing.ModelSpace.AddRegion(ent)
Set cylinder1 = ThisDrawing.ModelSpace.AddExtrudedSolid(reg1(0), l1, 0)
'Second extrusion
Set ent(0) = circle2
reg2 = ThisDrawing.ModelSpace.AddRegion(ent)
Set cylinder2 = ThisDrawing.ModelSpace.AddExtrudedSolid(reg2(0), l1, 0)
reg1(0).Delete
reg2(0).Delete
circle1.Delete
circle2.Delete
"If you're not part of the solution, you're part of the problem" - John McClane,Die hard