Jump to content

VBA AutoCAD 2008 to 2011


ramanusu

Recommended Posts

Hi All,

Anyone can help my problem, I have VBA code it's working fine in AutoCAD 2008. but it's not woeking in AutoCAD 2011. after hide the forms, i can't get my cad scr. thanks for your helping.

Link to comment
Share on other sites

Thanks for your reply. It's not working. i used get point fountion to get the point from user. after hiding the forms. user can't acess AutoCAD :(

Link to comment
Share on other sites

Try stepping through your code in the debug window to the code before you cant access the graphic screen. Then post the problem area in your code so that we can have a look at it.

Link to comment
Share on other sites

see my code below.

 

 
Private Sub CommandButton5_Click()

On Error GoTo ErrHandler


Pump_curve_main.Hide
ThisDrawing.Activate
Call pick_point

TextBox11.text = CStr(Round(scale_pt(0), 0))
TextBox12.text = CStr(Round(scale_pt(1), 0))
ThisDrawing.Activate
Pump_curve_main.Show
Exit Sub

ErrHandler:
MsgBox "Please Pick a Point Error: " & _
Err.Description, vbDefaultButton1, "Pump Curve Creator"
Pump_curve_main.Show
Exit Sub
End Sub

Sub pick_point()

scale_pt = ThisDrawing.Utility.GetPoint(, "Pick a Scale origin point:")

End Sub

Link to comment
Share on other sites

I tried your code and it works fine, I can pick a point and the rounded coordinates are displayed in two text boxes.

 

What I don't see in your code is the declaration for the variable 'scale_pt'. I declared it as a variant

Dim scale_pt As Variant

Check your declaration of the variable and note that there are no parentheses { () } in the declaration.

Link to comment
Share on other sites

While using that point i try to draw a line it's gave a error

 

"The object invoked has disconnected from clients"

Link to comment
Share on other sites

To draw a line you need at least two points. You need to save the point you picked in a variable, then repeat the point picking and save that point in another variable. Then you can use these two points to draw your line.

 

BTW did you manage to get your code to work?

Link to comment
Share on other sites

you re right. I get that point and add some value in y axis for 2nd point. i have draw line while form showing time. it's draw in AutoCad 2008 but it's not working in Autcad 2010. i don't know why :(

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