×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Contact US

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!

*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

Vector Drawing

Vector Drawing

Vector Drawing

(OP)
Now here is the problem
The inputs are the length of beams
as the lengths are entered i want to show a solid line corresponding the beam.
the second input is the location of load on the beam.
Now i want a vert line representing load to be dispalyed over the previos solid line. let suppose the first beam(hor.) was of 10 ft now the loads are at 3 ft from right.
i just want to kno which topic i should scroll for this and if i can get hints onthis it would be great.
    thanx

RE: Vector Drawing

Is this a VB problem? Do you want to automate the drawing of lines in a CAD package? If so, which one? Need more info!

DimensionalSolutions@Core.com
While I welcome e-mail messages, please post all thread activity in these forums for the benefit of all members.

RE: Vector Drawing

To draw a line, use the AddLine method:

Set lineObj = ThisDrawing.ModelSpace.AddLine(pt1, pt2)


How much do you have programmed so far? Can you connect to AutoCAD? Open an existing drawing or start a new drawing? Do you have a front end to get the user's inputs?

DimensionalSolutions@Core.com
While I welcome e-mail messages, please post all thread activity in these forums for the benefit of all members.

RE: Vector Drawing

(OP)
i Havent yet programmed far enough to open a new drawing in the running VB prog.
Is it true that every time i call a new autocad drawing to start the whole auotoCAD software is launched with it, as it can slow the procedure a lot.
I have an EXE file of such a programme made on VB with me is there a way to DECODE it?

RE: Vector Drawing

What versions of VB and AutoCAD are you using?

DimensionalSolutions@Core.com
While I welcome e-mail messages, please post all thread activity in these forums for the benefit of all members.

RE: Vector Drawing

(OP)
VB6
AutoCad 2000

RE: Vector Drawing

I am not sure about reverse engineering an exe file. I will try to work up a sample of how to interface with AutoCAD, start a new drawing, draw a part and save the file. Time is short right now, but it is on the list!

DimensionalSolutions@Core.com
While I welcome e-mail messages, please post all thread activity in these forums for the benefit of all members.

RE: Vector Drawing

(OP)
i know how to open the saved autocad file on VB6 .. i was wondering how to use it through running of vb programme?
either tell me or guide me to the source plz

RE: Vector Drawing

Start a new VB Project. To Form1, add two text boxed and name them (txtLength and txtHeight). Add two buttons and name them (cmdOK and cmdCancel). Add this code to the form:

Option Explicit

Private Sub cmdCancel_Click()
    Unload Me
    End
End Sub

Private Sub cmdOK_Click()
    Dim rLen As Double, rHgt As Double
    Dim CadApp As AcadApplication
    Dim CadDwg As AcadDocument
    Dim lineObj As AcadLine
    Dim textObj As AcadText
    Dim pt1(0 To 2) As Double, pt2(0 To 2) As Double, pt3(0 To 2) As Double
    Dim pt4(0 To 2) As Double, pt5(0 To 2) As Double
    Dim x As Integer, y As Integer, z As Integer
    x = 0
    y = 1
    z = 2

    'Get the textbox values
    If IsNumeric(txtLength.Text) = True Then
        rLen = CDbl(txtLength.Text)
    Else
        MsgBox "Invalid Length"
        Exit Sub
    End If
    If IsNumeric(txtHeight.Text) = True Then
        rHgt = CDbl(txtHeight.Text)
    Else
        MsgBox "Invalid Height"
        Exit Sub
    End If
    '<><><><><><><><><><><><><><><><><><><><><>
    '  Connect to AutoCAD
    '<><><><><><><><><><><><><><><><><><><><><>
    On Error Resume Next
TryAgain:
    Set CadApp = GetObject(, "AutoCAD.Application")
    If Err.Number <> 0 Then     'Not Running
        Set CadApp = CreateObject("AutoCAD.Application")
        Err.Clear
        'AutoCAD may open a new drawing upon opening - close it
        CadApp.ActiveDocument.Close False
        If Err.Number <> 0 Then
            Err.Clear   'No Drawings are Open
        End If
    End If
    On Error GoTo 0
    'Add a new drawing
    CadApp.Documents.Add
    Set CadDwg = CadApp.ActiveDocument
    
    'Define the points - start at 0,0
    pt1(x) = 0#: pt1(y) = 0#: pt1(z) = 0#
    
    pt2(x) = pt1(x) + rLen
    pt2(y) = pt1(y)
    pt2(z) = 0#
    
    pt3(x) = pt2(x)
    pt3(y) = pt2(y) + rHgt
    pt3(z) = 0#
    
    pt4(x) = pt1(x)
    pt4(y) = pt3(y)
    pt4(z) = 0#
    
    'Draw the lines
    Set lineObj = CadDwg.ModelSpace.AddLine(pt1, pt2)
    Set lineObj = CadDwg.ModelSpace.AddLine(pt2, pt3)
    Set lineObj = CadDwg.ModelSpace.AddLine(pt3, pt4)
    Set lineObj = CadDwg.ModelSpace.AddLine(pt4, pt1)
    
    'Add some text
    pt5(x) = (pt1(x) + pt2(x)) / 2
    pt5(y) = (pt1(y) + pt4(y)) / 2
    pt5(z) = 0#
    
    Set textObj = CadDwg.ModelSpace.AddText("HERE YOU GO!", pt5, 0.125)

    CadApp.ZoomExtents
    
    Set lineObj = Nothing
    Set CadDwg = Nothing
    Set CadApp = Nothing
    
    Unload Me
    End
End Sub


This sample will create a new drawing. Instead of CadApp.Documents.Add, use the CadApp.Documents.Open command to open an existing drawing. Then, the
Set CadDwg = CadApp.ActiveDocument
command will attach to the active drawing. From there, you can do whatever you need.

DimensionalSolutions@Core.com
While I welcome e-mail messages, please post all thread activity in these forums for the benefit of all members.

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! Already a Member? Login


Resources

Low-Volume Rapid Injection Molding With 3D Printed Molds
Learn methods and guidelines for using stereolithography (SLA) 3D printed molds in the injection molding process to lower costs and lead time. Discover how this hybrid manufacturing process enables on-demand mold fabrication to quickly produce small batches of thermoplastic parts. Download Now
Design for Additive Manufacturing (DfAM)
Examine how the principles of DfAM upend many of the long-standing rules around manufacturability - allowing engineers and designers to place a part’s function at the center of their design considerations. Download Now
Taking Control of Engineering Documents
This ebook covers tips for creating and managing workflows, security best practices and protection of intellectual property, Cloud vs. on-premise software solutions, CAD file management, compliance, and more. Download Now

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:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close