.NET

Reply
New Member
sudhir2009
Posts: 1
Registered: ‎05-03-2013
Message 1 of 2 (131 Views)

Problem with draft

131 Views, 1 Replies
05-03-2013 02:38 AM

i want to attach template on my drawing through c# code, can any one help me how to do this.

ADN Support Specialist
fenton.webb
Posts: 352
Registered: ‎07-24-2007
Message 2 of 2 (72 Views)

Re: Problem with draft

05-09-2013 09:19 AM in reply to: sudhir2009

You can use http://www.theswamp.org/index.php?topic=44313.0

 

Imports Autodesk.AutoCAD.Runtime
Imports Autodesk.AutoCAD.DatabaseServices
Imports Autodesk.AutoCAD.Geometry
Imports Autodesk.AutoCAD.EditorInput
Imports Autodesk.AutoCAD.ApplicationServices
Imports System.IO
Public Class Class2
    <CommandMethod("AddtoBT")> _
       Public Sub InsBlock()
            Dim FileNameLoc As String = "C:\TEMP\CIRCLESQUARE.DWG"
            Dim FileName As String = "CIRCLESQUARE"
            Dim doc As Document = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument
            Dim db As Database = doc.Database
            Dim xDB As New Database(False, True)
            xDB.ReadDwgFile(FileNameLoc, FileShare.Read, True, Nothing)
            Using tr As Transaction = doc.TransactionManager.StartTransaction()
                Dim bt As BlockTable = DirectCast(tr.GetObject(db.BlockTableId, OpenMode.ForWrite), BlockTable)
                Dim id As ObjectId = db.Insert(FileName, xDB, True)
                tr.Commit()
            End Using
        End Sub





Fenton Webb

Developer Technical Services

Autodesk Developer Network


Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.