<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Add a DWF Underlay in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/add-a-dwf-underlay/m-p/2638629#M66778</link>
    <description>I´m develop a function in AutoCad Map 2010 to add a Dwf Underlay from an external file.&lt;BR /&gt;
 &lt;BR /&gt;
I've tried with the following code but it doesn't work&lt;BR /&gt;
&lt;BR /&gt;
{code}&lt;BR /&gt;
	Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;&lt;BR /&gt;
	Database db = doc.Database;&lt;BR /&gt;
	Transaction tr = db.TransactionManager.StartTransaction();&lt;BR /&gt;
&lt;BR /&gt;
	//DWFDEFINITION&lt;BR /&gt;
	DwfDefinition dd = new DwfDefinition();&lt;BR /&gt;
	dd.SourceFileName = "C:\\nameFile.dwf";&lt;BR /&gt;
	dd.ItemName = "nameFile";&lt;BR /&gt;
	&lt;BR /&gt;
	dd.Load("");&lt;BR /&gt;
&lt;BR /&gt;
	DBDictionary dict = (DBDictionary)tr.GetObject(db.NamedObjectsDictionaryId, OpenMode.ForWrite);&lt;BR /&gt;
	dict.SetAt("nameFile - nameFile", dd);&lt;BR /&gt;
	&lt;BR /&gt;
	// DWFREFERENCE&lt;BR /&gt;
	DwfReference dr = new DwfReference();&lt;BR /&gt;
	dr.DefinitionId = dd.ObjectId;&lt;BR /&gt;
&lt;BR /&gt;
	dr.Position = new Point3d(10.6134597527748, 12.566448809153, 0);&lt;BR /&gt;
	dr.Rotation = 1.0;&lt;BR /&gt;
	dr.ScaleFactors = new Scale3d(0.111529677577706, 0.111529677577706, 0.111529677577706);&lt;BR /&gt;
&lt;BR /&gt;
	BlockTableRecord btr = (BlockTableRecord)tr.GetObject(db.CurrentSpaceId, OpenMode.ForWrite);&lt;BR /&gt;
	btr.AppendEntity(dr);&lt;BR /&gt;
	tr.AddNewlyCreatedDBObject(dr, true);&lt;BR /&gt;
	&lt;BR /&gt;
	tr.Commit();&lt;BR /&gt;
{code}&lt;BR /&gt;
&lt;BR /&gt;
What am I doing wrong?&lt;BR /&gt;
Why it doesn't work or how must I do it?&lt;BR /&gt;
 &lt;BR /&gt;
I'll appreciate any comment</description>
    <pubDate>Wed, 24 Feb 2010 14:11:22 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2010-02-24T14:11:22Z</dc:date>
    <item>
      <title>Add a DWF Underlay</title>
      <link>https://forums.autodesk.com/t5/net-forum/add-a-dwf-underlay/m-p/2638629#M66778</link>
      <description>I´m develop a function in AutoCad Map 2010 to add a Dwf Underlay from an external file.&lt;BR /&gt;
 &lt;BR /&gt;
I've tried with the following code but it doesn't work&lt;BR /&gt;
&lt;BR /&gt;
{code}&lt;BR /&gt;
	Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;&lt;BR /&gt;
	Database db = doc.Database;&lt;BR /&gt;
	Transaction tr = db.TransactionManager.StartTransaction();&lt;BR /&gt;
&lt;BR /&gt;
	//DWFDEFINITION&lt;BR /&gt;
	DwfDefinition dd = new DwfDefinition();&lt;BR /&gt;
	dd.SourceFileName = "C:\\nameFile.dwf";&lt;BR /&gt;
	dd.ItemName = "nameFile";&lt;BR /&gt;
	&lt;BR /&gt;
	dd.Load("");&lt;BR /&gt;
&lt;BR /&gt;
	DBDictionary dict = (DBDictionary)tr.GetObject(db.NamedObjectsDictionaryId, OpenMode.ForWrite);&lt;BR /&gt;
	dict.SetAt("nameFile - nameFile", dd);&lt;BR /&gt;
	&lt;BR /&gt;
	// DWFREFERENCE&lt;BR /&gt;
	DwfReference dr = new DwfReference();&lt;BR /&gt;
	dr.DefinitionId = dd.ObjectId;&lt;BR /&gt;
&lt;BR /&gt;
	dr.Position = new Point3d(10.6134597527748, 12.566448809153, 0);&lt;BR /&gt;
	dr.Rotation = 1.0;&lt;BR /&gt;
	dr.ScaleFactors = new Scale3d(0.111529677577706, 0.111529677577706, 0.111529677577706);&lt;BR /&gt;
&lt;BR /&gt;
	BlockTableRecord btr = (BlockTableRecord)tr.GetObject(db.CurrentSpaceId, OpenMode.ForWrite);&lt;BR /&gt;
	btr.AppendEntity(dr);&lt;BR /&gt;
	tr.AddNewlyCreatedDBObject(dr, true);&lt;BR /&gt;
	&lt;BR /&gt;
	tr.Commit();&lt;BR /&gt;
{code}&lt;BR /&gt;
&lt;BR /&gt;
What am I doing wrong?&lt;BR /&gt;
Why it doesn't work or how must I do it?&lt;BR /&gt;
 &lt;BR /&gt;
I'll appreciate any comment</description>
      <pubDate>Wed, 24 Feb 2010 14:11:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/add-a-dwf-underlay/m-p/2638629#M66778</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-02-24T14:11:22Z</dc:date>
    </item>
    <item>
      <title>Re: Add a DWF Underlay</title>
      <link>https://forums.autodesk.com/t5/net-forum/add-a-dwf-underlay/m-p/2638630#M66779</link>
      <description>The attached file has code I have used to do this...</description>
      <pubDate>Wed, 24 Feb 2010 19:36:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/add-a-dwf-underlay/m-p/2638630#M66779</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-02-24T19:36:06Z</dc:date>
    </item>
    <item>
      <title>Re: Add a DWF Underlay</title>
      <link>https://forums.autodesk.com/t5/net-forum/add-a-dwf-underlay/m-p/2638631#M66780</link>
      <description>jejamesNC,&lt;BR /&gt;
&lt;BR /&gt;
Thanks for your help, works perfectly!&lt;BR /&gt;
Greetings</description>
      <pubDate>Wed, 24 Feb 2010 23:03:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/add-a-dwf-underlay/m-p/2638631#M66780</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-02-24T23:03:54Z</dc:date>
    </item>
  </channel>
</rss>

