Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations MintJulep on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBA - Preview

Status
Not open for further replies.

bedasy

Structural
Dec 31, 2004
4
I'm programing a VBA application for AutoCAD 2005. I would like to show a preview of a 2DPolyline on a userform before actually drawing it in modelspace.

Some threads on the Autodesk Forum mentioned the dwgthumbnail.ocx but the closest thing I found on my computer is CThumbnailCtrl.ocx (by Autodesk). Unfortunately, there is no help file, so I don't know what it can do nor how to use it.

Any one can help?
 
Replies continue below

Recommended for you

I do not think that is what you want. You probably want an image control for your form (but I am not sure what and how you are doing).

"Everybody is ignorant, only on different subjects." — Will Rogers
 
In the UserForm module, use Additem method to display 2DPolyline preview. For example:

Sub Userform_initialize()
For Each 2dpoly in ThisDrawing.2dpoly
2dpolyobj.AddItem 2dpolyline
next 2dpoly
End Sub

Hope this helps,

John
 
First, I'd like to tank you for your answer but unfortunately they are not very helpfull. Second, I hope my english is not to hard to understand (I speak french).

To be more explicit, I want to draw structural shape (W, HSS, Channel, L...) in modelspace using a closed 2DPolyline. I already program the Sub in VBA to draw them and it's working perfectly.

When the macro starts, the user must input some parameters in a form (type of shape, dimensions of the section...). What I woud like to do is to show the 2Dpolyline on the Form before drawing it in model space.

A image control can do, but it's not the perfect solution.

Basically, I want to be able to draw on a userForm using AutoCAD feature. Is there a control in VBA or VB6 I can used?

Thanks
 
as far as I am aware, there are no controls which allow interactive "drawing" on a from at runtime.
Whenever I've had to do something along similar lines, I get around it by using a series of pictures and change the visibility as requried. It's not great but it works for my purposes
 
VB6 has drawing capability, easy for your situation. I am not at home right now so I can't send you code snippets, but my program solicits design information and draws the object in a VB form, then creates a dxf file for import into autocad. It is a stand alone exe, not a VBA application inside Autocad. Do you think this would help?
 
not to throw a spanner in the works but the original question was about controls for VBA, not VB. While the two are very similar in some respects, there are a whole lot of things not available to the VBA programmer.
 
Hendie, you are correct. Also, VB does not have have ACAD object commands and methods like in VBA.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor