Results 1 to 7 of 7

Thread: How to open a drawing from Windows Application?

  1. #1
    Member
    Join Date
    2015-12
    Location
    Las Vegas, NV
    Posts
    20
    Login to Give a bone
    0

    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,269
    Login to Give a bone
    0

    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

  3. #3
    Member
    Join Date
    2015-12
    Location
    Las Vegas, NV
    Posts
    20
    Login to Give a bone
    0

    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,269
    Login to Give a bone
    0

    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.

  5. #5
    Member
    Join Date
    2015-12
    Location
    Las Vegas, NV
    Posts
    20
    Login to Give a bone
    0

    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
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,719
    Login to Give a bone
    0

    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.
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

  7. #7
    AUGI Addict fixo's Avatar
    Join Date
    2005-05
    Location
    Pietari, Venäjä
    Posts
    1,269
    Login to Give a bone
    0

    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.

Similar Threads

  1. Replies: 10
    Last Post: 2023-01-24, 06:27 PM
  2. Dual application windows
    By Wish List System in forum AutoCAD Wish List
    Replies: 5
    Last Post: 2014-03-04, 02:15 AM
  3. Replies: 8
    Last Post: 2007-08-06, 02:58 PM
  4. Open application windows in certain positions on dual monitors
    By robert.1.hall72202 in forum Software
    Replies: 5
    Last Post: 2007-06-19, 01:53 PM
  5. Drawing Walk - a drawing browser CUI application
    By zoomharis in forum AutoCAD Customization
    Replies: 10
    Last Post: 2007-03-20, 10:45 AM

Posting Permissions

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