Results 1 to 7 of 7

Thread: How to open a drawing from Windows Application?

  1. #1
    Member
    Join Date
    2008-04
    Location
    Las Vegas, NV
    Posts
    19

    Default How to open a drawing from Windows Application?

    How can I get my app to open AutoCAD and then open the file that i have selected?

    Imports System
    Imports System.IO

    Public Class Form1

    Dim PathAcad As String = "C:\Program Files\AutoCAD Map 3D 2010\acad.exe"
    Dim DwgFile As String

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    OpenFileDialog1.Filter = "Drawing File(*.dwg)|*.dwg"
    OpenFileDialog1.FileName = ""
    OpenFileDialog1.ShowDialog()
    DwgFile = OpenFileDialog1.FileName
    If IO.File.Exists(PathAcad) = True Then
    Dim p As New Diagnostics.Process
    p.StartInfo.FileName = PathAcad
    p.Start()
    End If

    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
    Me.Close()
    End Sub
    End Class


    Thanks for any help!

  2. #2
    AUGI Addict fixo's Avatar
    Join Date
    2005-05
    Location
    Pietari, Venäjä
    Posts
    1,227

    Default Re: How to open a drawing from Windows Application?

    Welcome on board
    Try attached code, it's very basic though -
    this will open a drawing by name and draw the circle
    in the model space, then it will save a drawing and nothing else
    Hope this will to get you started
    Attached Files Attached Files
    "The whole problem with the world is that fools and fanatics are always
    so certain of themselves, and wiser people so full of doubts."
    Bertrand Russell

  3. #3
    Member
    Join Date
    2008-04
    Location
    Las Vegas, NV
    Posts
    19

    Smile Re: How to open a drawing from Windows Application?

    Thanks

    Corn

  4. #4
    AUGI Addict fixo's Avatar
    Join Date
    2005-05
    Location
    Pietari, Venäjä
    Posts
    1,227

    Default Re: How to open a drawing from Windows Application?

    You're welcome
    But what is your goal?
    Cheers
    Last edited by fixo; 2011-06-24 at 09:05 AM.
    "The whole problem with the world is that fools and fanatics are always
    so certain of themselves, and wiser people so full of doubts."
    Bertrand Russell

  5. #5
    Member
    Join Date
    2008-04
    Location
    Las Vegas, NV
    Posts
    19

    Smile Re: How to open a drawing from Windows Application?

    The Goal is to open a drawing or drawings and import a block or text and close drawing(s) and make read only.

    So when the next person open the drawing they will know not to make any changes.

    Thanks again.

  6. #6
    Moderator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    2,493

    Default Re: How to open a drawing from Windows Application?

    Just curious, but isn't there a way (from a Windows app) to send the "Target" string from an AutoCAD application icon via Shell, using some startup switches?

    For example:

    Code:
    "drive:pathname\acad.exe" ["drawing name"] [/switch "name"]
    More on Startup Switches.
    "Potential has a shelf life." - Margaret Atwood

  7. #7
    AUGI Addict fixo's Avatar
    Join Date
    2005-05
    Location
    Pietari, Venäjä
    Posts
    1,227

    Default Re: How to open a drawing from Windows Application?

    Umm .. a lot of work, as well as it is needs after
    to set file attribute to read-only using FileInfo namespace
    Can you be more specfic?
    What is the block (from other drawing, attributed or not) &etc
    better yet step-by-step for my dim brain
    Ok, then I will try but I don't guarantee
    Attached is a quick exe, this will insert source drawing as block
    into the target drawing and make it read-only after
    Attached Files Attached Files
    Last edited by fixo; 2011-07-10 at 08:51 PM.
    "The whole problem with the world is that fools and fanatics are always
    so certain of themselves, and wiser people so full of doubts."
    Bertrand Russell

Similar Threads

  1. Windows form based stand alone application
    By pasxos867044 in forum VBA/COM Interop
    Replies: 4
    Last Post: 2012-09-21, 04:20 AM
  2. Replies: 8
    Last Post: 2007-08-06, 02:58 PM
  3. Replies: 5
    Last Post: 2007-06-19, 01:53 PM
  4. Drawing Walk - a drawing browser CUI application
    By zoomharis in forum AutoCAD Customization
    Replies: 10
    Last Post: 2007-03-20, 10:45 AM
  5. Replies: 8
    Last Post: 2006-05-01, 06:39 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •