×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Are you an
Engineering professional?
Join Eng-Tips Forums!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

#### Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

# 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?

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)

"If you're not part of the solution, you're part of the problem" - John McClane,Die hard

### RE: VBA circles extrusion

(OP)
Nevermind. Problem solved!

"If you're not part of the solution, you're part of the problem" - John McClane,Die hard

### RE: VBA circles extrusion

(OP)
Hi,

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 reg1, reg2 As Variant

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
Set cylinder1 = ThisDrawing.ModelSpace.AddExtrudedSolid(reg1(0), l1, 0)

'Second extrusion

Set ent(0) = circle2
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

#### Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

#### Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Close Box

# Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!