<?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: output   the center co-ordinate of selected circle in VBA Forum</title>
    <link>https://forums.autodesk.com/t5/vba-forum/create-or-open-excel-file/m-p/5321857#M10265</link>
    <description>&lt;P&gt;It looks like you need a bit study on what type of objects you are dealing with in AutoCAD. You can open AutoCAD, go into VBA Editor, open Object Browser window and see all the objects available in AutoCAD object model.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;From the few lines of code, it is not clear what the "obj" is: a block reference (AcadBlockReference), or a circle (AcadCircle)?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If it is the former, then an AcadBlockReferece does nto have property like "CenterPoint..."; if it is an AcadCircle, it should have a property Center, but not CentrePointX/Y/Z and it does not have property "Name" or "EffectiveName"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, you need to know WHAT AcadEntity or AcadEntities you are dealing with, and know what properties the target entity has.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now, assume you are targeting a circle (AcadCircle), and needs to know its centre's coordinate, you do:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Range(...)=obj.Center[0]&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Range(...)=obj.Center[1]&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Range(...)=obj.Center[2]&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Because Center propery is an 3-element array of Double values, representing X,Y and Z of coordinate&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If you are targeting block, then there is no property Center, Instead, it has InsertionPoint property.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If you are targeting mixed entity types, you then need to treat them differently with the help of&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If TypeOf obj is AcadCicle Then&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; ''Do something&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;ElseIf TyoeOf obj Is AadBlockReference Then&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; ....&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Else&lt;/P&gt;
&lt;P&gt;&amp;nbsp; ....&lt;/P&gt;
&lt;P&gt;End If&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 07 Oct 2014 13:30:40 GMT</pubDate>
    <dc:creator>norman.yuan</dc:creator>
    <dc:date>2014-10-07T13:30:40Z</dc:date>
    <item>
      <title>create or open excel file</title>
      <link>https://forums.autodesk.com/t5/vba-forum/create-or-open-excel-file/m-p/5317865#M10261</link>
      <description>&lt;P&gt;I am trying to create an excel file using autocad vba using following code but I get compile error as &lt;STRONG&gt;User-defined type not defined&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dim oApp_Excel As Excel.Application&lt;BR /&gt;Dim oBook As Excel.workbook&lt;/P&gt;&lt;P&gt;Set oApp_Excel = CreateObject("EXCEL.APPLICATION")&lt;BR /&gt;Set oBook = oApp_Excel.workbooks.Add&lt;/P&gt;</description>
      <pubDate>Sun, 05 Oct 2014 09:58:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/create-or-open-excel-file/m-p/5317865#M10261</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-10-05T09:58:33Z</dc:date>
    </item>
    <item>
      <title>Re: create or open excel file</title>
      <link>https://forums.autodesk.com/t5/vba-forum/create-or-open-excel-file/m-p/5317975#M10262</link>
      <description>&lt;P&gt;You need to add "Microsoft Excel [Version] Library" as reference (VBAIDE-&amp;gt;Menu-&amp;gt;Tools-&amp;gt;References...)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 05 Oct 2014 14:18:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/create-or-open-excel-file/m-p/5317975#M10262</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2014-10-05T14:18:45Z</dc:date>
    </item>
    <item>
      <title>Re: create or open excel file</title>
      <link>https://forums.autodesk.com/t5/vba-forum/create-or-open-excel-file/m-p/5318587#M10263</link>
      <description>&lt;P&gt;thanks norman&lt;/P&gt;</description>
      <pubDate>Mon, 06 Oct 2014 08:01:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/create-or-open-excel-file/m-p/5318587#M10263</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-10-06T08:01:14Z</dc:date>
    </item>
    <item>
      <title>output   the center co-ordinate of selected circle</title>
      <link>https://forums.autodesk.com/t5/vba-forum/create-or-open-excel-file/m-p/5320957#M10264</link>
      <description>&lt;P&gt;I want to output into excel&amp;nbsp;the name, layer and center co-ordinate of selected circle . I succeed in name and layer but could not get centre co-ordinate.&lt;/P&gt;&lt;P&gt;I used following code.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;wrks.Range("A" &amp;amp; rownr) = obj.Name&lt;BR /&gt;wrks.Range("B" &amp;amp; rownr) = obj.Layer&lt;BR /&gt;wrks.Range("C" &amp;amp; rownr) = obj.EffectiveName&lt;BR /&gt;wrks.Range("D" &amp;amp; rownr) = obj.&lt;SPAN&gt;CentrePointx&lt;/SPAN&gt;&lt;BR /&gt;wrks.Range("E" &amp;amp; rownr) = obj.&lt;SPAN&gt;CentrePointy&lt;/SPAN&gt;&lt;BR /&gt;wrks.Range("F" &amp;amp; rownr) = obj.&lt;SPAN&gt;CentrePointz&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Oct 2014 02:09:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/create-or-open-excel-file/m-p/5320957#M10264</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-10-07T02:09:30Z</dc:date>
    </item>
    <item>
      <title>Re: output   the center co-ordinate of selected circle</title>
      <link>https://forums.autodesk.com/t5/vba-forum/create-or-open-excel-file/m-p/5321857#M10265</link>
      <description>&lt;P&gt;It looks like you need a bit study on what type of objects you are dealing with in AutoCAD. You can open AutoCAD, go into VBA Editor, open Object Browser window and see all the objects available in AutoCAD object model.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;From the few lines of code, it is not clear what the "obj" is: a block reference (AcadBlockReference), or a circle (AcadCircle)?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If it is the former, then an AcadBlockReferece does nto have property like "CenterPoint..."; if it is an AcadCircle, it should have a property Center, but not CentrePointX/Y/Z and it does not have property "Name" or "EffectiveName"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, you need to know WHAT AcadEntity or AcadEntities you are dealing with, and know what properties the target entity has.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now, assume you are targeting a circle (AcadCircle), and needs to know its centre's coordinate, you do:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Range(...)=obj.Center[0]&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Range(...)=obj.Center[1]&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Range(...)=obj.Center[2]&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Because Center propery is an 3-element array of Double values, representing X,Y and Z of coordinate&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If you are targeting block, then there is no property Center, Instead, it has InsertionPoint property.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If you are targeting mixed entity types, you then need to treat them differently with the help of&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If TypeOf obj is AcadCicle Then&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; ''Do something&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;ElseIf TyoeOf obj Is AadBlockReference Then&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; ....&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Else&lt;/P&gt;
&lt;P&gt;&amp;nbsp; ....&lt;/P&gt;
&lt;P&gt;End If&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Oct 2014 13:30:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/create-or-open-excel-file/m-p/5321857#M10265</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2014-10-07T13:30:40Z</dc:date>
    </item>
  </channel>
</rss>

