<?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 Re: AddDimAligned problem i Acad 2000 in VBA Forum</title>
    <link>https://forums.autodesk.com/t5/vba-forum/adddimaligned-problem-i-acad-2000/m-p/322274#M93215</link>
    <description>Trond,&lt;BR /&gt;
&lt;BR /&gt;
QUESTION:&lt;BR /&gt;
&lt;BR /&gt;
The AddDimAligned method of Block object produces incorrect dimension&lt;BR /&gt;
objects.&lt;BR /&gt;
How can I add dimension entities to a Block object?&lt;BR /&gt;
&lt;BR /&gt;
ANSWER:&lt;BR /&gt;
&lt;BR /&gt;
The AddDimAligned method as well as other AddDimxxx methods of adding&lt;BR /&gt;
dimension&lt;BR /&gt;
entities to a Block object results in dimension objects that are incorrect.&lt;BR /&gt;
&lt;BR /&gt;
This is a known problem. Use the following workaround to add dimension&lt;BR /&gt;
entities&lt;BR /&gt;
to a block object:&lt;BR /&gt;
&lt;BR /&gt;
   1.  Create a Dimension entity in model space.&lt;BR /&gt;
   2.  Use the CopyObject method to copy the Dimension entity to a Block&lt;BR /&gt;
object.&lt;BR /&gt;
   3.  Delete the original Dimension entity from model space.&lt;BR /&gt;
&lt;BR /&gt;
The following sample code creates a block "test", adds a DimRotated entity&lt;BR /&gt;
to&lt;BR /&gt;
the block, and then inserts the block into model space.&lt;BR /&gt;
&lt;BR /&gt;
Sub f_SolAddDiminBlocks()&lt;BR /&gt;
'Workaround for Adding dimensions to block AutoCAD 2000.&lt;BR /&gt;
Dim po_rotDim As AcadDimAligned&lt;BR /&gt;
Dim po_block As AcadBlock&lt;BR /&gt;
Dim pd_ext1(0 To 2) As Double&lt;BR /&gt;
Dim pd_ext2(0 To 2) As Double&lt;BR /&gt;
Dim pd_lineLoc(0 To 2) As Double&lt;BR /&gt;
Dim po_array(0) As Object&lt;BR /&gt;
&lt;BR /&gt;
pd_ext1(0) = 3: pd_ext1(1) = 3: pd_ext1(2) = 0&lt;BR /&gt;
pd_ext2(0) = 10: pd_ext2(1) = 3: pd_ext2(2) = 0&lt;BR /&gt;
pd_lineLoc(0) = 5: pd_lineLoc(1) = 4: pd_lineLoc(2) = 0&lt;BR /&gt;
'create dimeionsion object&lt;BR /&gt;
Set po_rotDim = ThisDrawing.ModelSpace.AddDimAligned(pd_ext1, pd_ext2,&lt;BR /&gt;
pd_lineLoc)&lt;BR /&gt;
&lt;BR /&gt;
'create a new block by name test&lt;BR /&gt;
Set po_block = ThisDrawing.Blocks.Add(pd_ext1, "test")&lt;BR /&gt;
'insert a block reference&lt;BR /&gt;
ThisDrawing.ModelSpace.InsertBlock pd_ext1, "test", 1, 1, 1, 0&lt;BR /&gt;
&lt;BR /&gt;
'copy dimension object&lt;BR /&gt;
Set po_array(0) = po_rotDim&lt;BR /&gt;
ThisDrawing.CopyObjects po_array, po_block&lt;BR /&gt;
po_rotDim.Delete&lt;BR /&gt;
&lt;BR /&gt;
'release the references&lt;BR /&gt;
Set po_block = Nothing&lt;BR /&gt;
Set po_rotDim = Nothing&lt;BR /&gt;
End Sub&lt;BR /&gt;
&lt;BR /&gt;
Cheers,&lt;BR /&gt;
Thilak&lt;BR /&gt;
&lt;BR /&gt;
Trond Andenæs &lt;TANDENAS&gt; wrote in message&lt;BR /&gt;
news:ef1bf43.-1@WebX.SaUCah8kaAW...&lt;BR /&gt;
&amp;gt; In AutoCAD 14.01 I have made several programs i VBA where I use&lt;BR /&gt;
&amp;gt; AddDimAligned in a block.&lt;BR /&gt;
&amp;gt; with no problems.&lt;BR /&gt;
&amp;gt; When I use the programs in Acad2000, the lengths are always being set to&lt;BR /&gt;
&amp;gt; zero, but if I explode&lt;BR /&gt;
&amp;gt; the block, it's getting right.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; --&lt;BR /&gt;
&amp;gt; Thanks&lt;BR /&gt;
&amp;gt; Trond Andenæs&lt;BR /&gt;
&amp;gt; Wero Klimaprodukter AS&lt;BR /&gt;
&amp;gt; Øvre Ullern terasse 15a&lt;BR /&gt;
&amp;gt; 0380 Oslo&lt;BR /&gt;
&amp;gt; Tel: 22 50 15 60&lt;BR /&gt;
&amp;gt;&lt;/TANDENAS&gt;</description>
    <pubDate>Wed, 24 May 2000 14:43:46 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2000-05-24T14:43:46Z</dc:date>
    <item>
      <title>AddDimAligned problem i Acad 2000</title>
      <link>https://forums.autodesk.com/t5/vba-forum/adddimaligned-problem-i-acad-2000/m-p/322273#M93214</link>
      <description>In AutoCAD 14.01 I have made several programs i VBA where I use&lt;BR /&gt;
AddDimAligned in a block.&lt;BR /&gt;
with no problems.&lt;BR /&gt;
When I use the programs in Acad2000, the lengths are always being set to&lt;BR /&gt;
zero, but if I explode&lt;BR /&gt;
the block, it's getting right.&lt;BR /&gt;
&lt;BR /&gt;
--&lt;BR /&gt;
Thanks&lt;BR /&gt;
Trond Andenæs&lt;BR /&gt;
Wero Klimaprodukter AS&lt;BR /&gt;
Øvre Ullern terasse 15a&lt;BR /&gt;
0380 Oslo&lt;BR /&gt;
Tel: 22 50 15 60</description>
      <pubDate>Wed, 24 May 2000 11:21:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/adddimaligned-problem-i-acad-2000/m-p/322273#M93214</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2000-05-24T11:21:13Z</dc:date>
    </item>
    <item>
      <title>Re: AddDimAligned problem i Acad 2000</title>
      <link>https://forums.autodesk.com/t5/vba-forum/adddimaligned-problem-i-acad-2000/m-p/322274#M93215</link>
      <description>Trond,&lt;BR /&gt;
&lt;BR /&gt;
QUESTION:&lt;BR /&gt;
&lt;BR /&gt;
The AddDimAligned method of Block object produces incorrect dimension&lt;BR /&gt;
objects.&lt;BR /&gt;
How can I add dimension entities to a Block object?&lt;BR /&gt;
&lt;BR /&gt;
ANSWER:&lt;BR /&gt;
&lt;BR /&gt;
The AddDimAligned method as well as other AddDimxxx methods of adding&lt;BR /&gt;
dimension&lt;BR /&gt;
entities to a Block object results in dimension objects that are incorrect.&lt;BR /&gt;
&lt;BR /&gt;
This is a known problem. Use the following workaround to add dimension&lt;BR /&gt;
entities&lt;BR /&gt;
to a block object:&lt;BR /&gt;
&lt;BR /&gt;
   1.  Create a Dimension entity in model space.&lt;BR /&gt;
   2.  Use the CopyObject method to copy the Dimension entity to a Block&lt;BR /&gt;
object.&lt;BR /&gt;
   3.  Delete the original Dimension entity from model space.&lt;BR /&gt;
&lt;BR /&gt;
The following sample code creates a block "test", adds a DimRotated entity&lt;BR /&gt;
to&lt;BR /&gt;
the block, and then inserts the block into model space.&lt;BR /&gt;
&lt;BR /&gt;
Sub f_SolAddDiminBlocks()&lt;BR /&gt;
'Workaround for Adding dimensions to block AutoCAD 2000.&lt;BR /&gt;
Dim po_rotDim As AcadDimAligned&lt;BR /&gt;
Dim po_block As AcadBlock&lt;BR /&gt;
Dim pd_ext1(0 To 2) As Double&lt;BR /&gt;
Dim pd_ext2(0 To 2) As Double&lt;BR /&gt;
Dim pd_lineLoc(0 To 2) As Double&lt;BR /&gt;
Dim po_array(0) As Object&lt;BR /&gt;
&lt;BR /&gt;
pd_ext1(0) = 3: pd_ext1(1) = 3: pd_ext1(2) = 0&lt;BR /&gt;
pd_ext2(0) = 10: pd_ext2(1) = 3: pd_ext2(2) = 0&lt;BR /&gt;
pd_lineLoc(0) = 5: pd_lineLoc(1) = 4: pd_lineLoc(2) = 0&lt;BR /&gt;
'create dimeionsion object&lt;BR /&gt;
Set po_rotDim = ThisDrawing.ModelSpace.AddDimAligned(pd_ext1, pd_ext2,&lt;BR /&gt;
pd_lineLoc)&lt;BR /&gt;
&lt;BR /&gt;
'create a new block by name test&lt;BR /&gt;
Set po_block = ThisDrawing.Blocks.Add(pd_ext1, "test")&lt;BR /&gt;
'insert a block reference&lt;BR /&gt;
ThisDrawing.ModelSpace.InsertBlock pd_ext1, "test", 1, 1, 1, 0&lt;BR /&gt;
&lt;BR /&gt;
'copy dimension object&lt;BR /&gt;
Set po_array(0) = po_rotDim&lt;BR /&gt;
ThisDrawing.CopyObjects po_array, po_block&lt;BR /&gt;
po_rotDim.Delete&lt;BR /&gt;
&lt;BR /&gt;
'release the references&lt;BR /&gt;
Set po_block = Nothing&lt;BR /&gt;
Set po_rotDim = Nothing&lt;BR /&gt;
End Sub&lt;BR /&gt;
&lt;BR /&gt;
Cheers,&lt;BR /&gt;
Thilak&lt;BR /&gt;
&lt;BR /&gt;
Trond Andenæs &lt;TANDENAS&gt; wrote in message&lt;BR /&gt;
news:ef1bf43.-1@WebX.SaUCah8kaAW...&lt;BR /&gt;
&amp;gt; In AutoCAD 14.01 I have made several programs i VBA where I use&lt;BR /&gt;
&amp;gt; AddDimAligned in a block.&lt;BR /&gt;
&amp;gt; with no problems.&lt;BR /&gt;
&amp;gt; When I use the programs in Acad2000, the lengths are always being set to&lt;BR /&gt;
&amp;gt; zero, but if I explode&lt;BR /&gt;
&amp;gt; the block, it's getting right.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; --&lt;BR /&gt;
&amp;gt; Thanks&lt;BR /&gt;
&amp;gt; Trond Andenæs&lt;BR /&gt;
&amp;gt; Wero Klimaprodukter AS&lt;BR /&gt;
&amp;gt; Øvre Ullern terasse 15a&lt;BR /&gt;
&amp;gt; 0380 Oslo&lt;BR /&gt;
&amp;gt; Tel: 22 50 15 60&lt;BR /&gt;
&amp;gt;&lt;/TANDENAS&gt;</description>
      <pubDate>Wed, 24 May 2000 14:43:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/adddimaligned-problem-i-acad-2000/m-p/322274#M93215</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2000-05-24T14:43:46Z</dc:date>
    </item>
  </channel>
</rss>

