×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

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

Students Click Here

Jobs

VBA - Preview

VBA - Preview

VBA - Preview

(OP)
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?

RE: VBA - Preview

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

RE: VBA - Preview

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

RE: VBA - Preview

(OP)
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

RE: VBA - Preview

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

RE: VBA - Preview

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?

RE: VBA - Preview

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.

RE: VBA - Preview

Hendie, you are correct.  Also, VB does not have have ACAD object commands and methods like in VBA.

 

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.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources