Question:

Autocad vba gui help

by  |  earlier

0 LIKES UnLike

ok im writing a vba routine to draw ductwork for me, and right now im just on the specific one that draws the two lines that are the outline of the duct. im looking to have the routine prompt for the duct width via a window that pops up with options. i wrote the code and designed the userform, but i dont know how to make the routine get the width variable from the pop up window.

heres my code:

Option Explicit

Public Sub DoubleDuct()

Dim intDuctWidth As Integer

Load UserForm2

Dim varStartPoint As Variant

Dim varEndPoint As Variant

Dim objBaseLine As AcadLine

On Error Resume Next

With ThisDrawing.Utility

varStartPoint = .GetPoint(, vbCr & "Start point: ")

varEndPoint = .GetPoint(varStartPoint, vbCr & "End point: ")

End With

If ThisDrawing.ActiveSpace = acModelSpace Then

Set objBaseLine = ThisDrawing.ModelSpace.AddLine(varStartP... varEndPoint)

Else

Set objBaseLine = ThisDrawing.PaperSpace.AddLine(varStartP... varEndPoint)

End If

objBaseLine.Update

Dim objOffsetLineOne As Variant

Dim objOffsetLineTwo As Variant

objOffsetLineOne = objBaseLine.Offset(intDuctWidth)

objOffsetLineTwo = objBaseLine.Offset(-1 * intDuctWidth)

End Sub

i have written the user form to set the variable intDuctWidth depending on which button you click. my problem, i think, is at my "Load UserForm2" line.

thanks in advance

 Tags:

   Report

1 ANSWERS


  1. If I understand correctly, you can prompt for your start and end points thus:

    varStartPoint = .GetPoint( InputBox( "Start point: ", "Start Point" ) )

    varEndPoint = .GetPoint( InputBox( "End Point: ", "End Point: ) )

You're reading: Autocad vba gui help

Question Stats

Latest activity: earlier.
This question has 1 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.