.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Problem with draft

1 REPLY 1
Reply
Message 1 of 2
sudhir2009
263 Views, 1 Reply

Problem with draft

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

1 REPLY 1
Message 2 of 2
fenton.webb
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
AutoCAD Engineering
Autodesk

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost