<?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: Base Point Location of Block Reference in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/base-point-location-of-block-reference/m-p/2477903#M70808</link>
    <description>Even more lacking in elegancy, but:&lt;BR /&gt;
&lt;BR /&gt;
                Point3d zero = new Point3d();&lt;BR /&gt;
&lt;BR /&gt;
                Point3d GCTp3d = zero - zero.TransformBy(br.BlockTransform.Inverse()).GetAsVector();//Crux&lt;BR /&gt;
&lt;BR /&gt;
                GCTp3d = GCTp3d.RotateBy(br.Rotation, new Vector3d(0.0,0.0,1.0),zero);</description>
    <pubDate>Fri, 01 May 2009 02:30:16 GMT</pubDate>
    <dc:creator>SEANT61</dc:creator>
    <dc:date>2009-05-01T02:30:16Z</dc:date>
    <item>
      <title>Base Point Location of Block Reference</title>
      <link>https://forums.autodesk.com/t5/net-forum/base-point-location-of-block-reference/m-p/2477890#M70795</link>
      <description>&lt;P&gt;&lt;BR /&gt;I am having trouble getting the "Base Point" of a Block Reference in autocad. I am not sure if base point is the correct terminology or not.&lt;BR /&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;If I perform a LIST command on a Block Reference in autocad the values for the location are the same as if I use the BlockReference.Position in .NET &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;i.e.&lt;BR /&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;BR /&gt;                  External reference&lt;BR /&gt;&lt;BR /&gt;                at point, X=128170.18580000  Y=44629.83387360  Z=26037.43318039&lt;BR /&gt;&lt;BR /&gt;   X scale factor: 1.00000000&lt;BR /&gt;&lt;BR /&gt;   Y scale factor: 1.00000000&lt;BR /&gt;&lt;BR /&gt;   Z scale factor: 1.00000000&lt;BR /&gt;&lt;BR /&gt;Extrusion direction relative to UCS:&lt;BR /&gt;&lt;BR /&gt;                   X=0.00000000  Y=-0.25881731  Z=0.96592629&lt;BR /&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;However if i use a LISP command (entget (car (entsel))) I get different values in the dxf code 10 position. The values that I get here, are the ones that I want to get in .NET.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;i.e.&lt;BR /&gt;&lt;BR /&gt;Select object: ((-1 . &amp;lt;Entity name: -51963e98&amp;gt;) (0 . "INSERT") (5 . "29F5") &lt;BR /&gt;&lt;BR /&gt;(102 . "{ACAD_XDICTIONARY") (360 . &amp;lt;Entity name: -51963e90&amp;gt;) (102 . "}") (330 . &lt;BR /&gt;&lt;BR /&gt;&amp;lt;Entity name: -4011f2f8&amp;gt;) (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . &lt;BR /&gt;&lt;BR /&gt;"ADE_TEMP") (100 . "AcDbBlockReference") (2 . "T61-5-2-0103") (10 128170.0 &lt;BR /&gt;&lt;BR /&gt;49848.1 13599.3) (41 . 1.0) (42 . 1.0) (43 . 1.0) (50 . 1.5708) (70 . 0) (71 . &lt;BR /&gt;&lt;BR /&gt;0) (44 . 0.0) (45 . 0.0) (210 0.0 -0.258817 0.965926))&lt;BR /&gt;&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;P&gt;&lt;BR /&gt;Does anyone know the equivalent .NET command to get the Block References original insertion point (base point) which is the same as a the DXF 10 code?&lt;BR /&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;In VBA I have noticed there is a object.BasePoint property however I do not know how to convert this to .NET.&lt;BR /&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Kate&lt;BR /&gt;&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 28 Apr 2009 23:45:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/base-point-location-of-block-reference/m-p/2477890#M70795</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-04-28T23:45:47Z</dc:date>
    </item>
    <item>
      <title>Re: Base Point Location of Block Reference</title>
      <link>https://forums.autodesk.com/t5/net-forum/base-point-location-of-block-reference/m-p/2477891#M70796</link>
      <description>The position property is the correct property.  Your issue of seeing different data from the entity data is likely to be related to the UCS not being world, in which case you just use the coordinate system translation matrix to convert the point from one UCS to the other.  There are several posts on this forum which describe how to do that.</description>
      <pubDate>Wed, 29 Apr 2009 00:44:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/base-point-location-of-block-reference/m-p/2477891#M70796</guid>
      <dc:creator>chiefbraincloud</dc:creator>
      <dc:date>2009-04-29T00:44:54Z</dc:date>
    </item>
    <item>
      <title>Re: Base Point Location of Block Reference</title>
      <link>https://forums.autodesk.com/t5/net-forum/base-point-location-of-block-reference/m-p/2477892#M70797</link>
      <description>I have had a look around today and I think my question is now - &lt;BR /&gt;
&lt;BR /&gt;
How do I translate the position of the block reference to what it was before the blockRef.Normal was applied. &lt;BR /&gt;
&lt;BR /&gt;
So I place the block Reference at the correct position&lt;BR /&gt;
I change the block reference's extrusion using Blockref.Normal which in turn gives it a new position.&lt;BR /&gt;
&lt;BR /&gt;
I need the original position of the block for my comparision. So i need to somehow "undo" the extrusion I have applied without manipulating the block. &lt;BR /&gt;
&lt;BR /&gt;
Im nearly certain I am doing all my calcualtion in WCS and position is in WCS, but I also dont really know what I'm doing &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;
&lt;BR /&gt;
I can post code if it will help in anyway.&lt;BR /&gt;
&lt;BR /&gt;
Cheers,&lt;BR /&gt;
&lt;BR /&gt;
Kate</description>
      <pubDate>Wed, 29 Apr 2009 06:20:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/base-point-location-of-block-reference/m-p/2477892#M70797</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-04-29T06:20:38Z</dc:date>
    </item>
    <item>
      <title>Re: Base Point Location of Block Reference</title>
      <link>https://forums.autodesk.com/t5/net-forum/base-point-location-of-block-reference/m-p/2477893#M70798</link>
      <description>Perhaps you can tell us what it is you ultimately are trying to do,&lt;BR /&gt;
since there may be easier ways.&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
http://www.caddzone.com&lt;BR /&gt;
&lt;BR /&gt;
AcadXTabs: MDI Document Tabs for AutoCAD 2009&lt;BR /&gt;
Supporting AutoCAD 2000 through 2009&lt;BR /&gt;
&lt;BR /&gt;
http://www.acadxtabs.com&lt;BR /&gt;
&lt;BR /&gt;
Introducing AcadXTabs 2010:&lt;BR /&gt;
http://www.caddzone.com/acadxtabs/AcadXTabs2010.htm&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;KWARMINGTON&gt; wrote in message news:6172404@discussion.autodesk.com...&lt;BR /&gt;
&lt;BR /&gt;
I am having trouble getting the "Base Point" of a Block Reference in &lt;BR /&gt;
autocad. I am not sure if base point is the correct terminology or not.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
If I perform a LIST command on a Block Reference in autocad the values for &lt;BR /&gt;
the location are the same as if I use the BlockReference.Position in .NET&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
i.e.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
External reference&lt;BR /&gt;
&lt;BR /&gt;
at point, X=128170.18580000 Y=44629.83387360 Z=26037.43318039&lt;BR /&gt;
&lt;BR /&gt;
X scale factor: 1.00000000&lt;BR /&gt;
&lt;BR /&gt;
Y scale factor: 1.00000000&lt;BR /&gt;
&lt;BR /&gt;
Z scale factor: 1.00000000&lt;BR /&gt;
&lt;BR /&gt;
Extrusion direction relative to UCS:&lt;BR /&gt;
&lt;BR /&gt;
X=0.00000000 Y=-0.25881731 Z=0.96592629&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
However if i use a LISP command (entget (car (entsel))) I get different &lt;BR /&gt;
values in the dxf code 10 position. The values that I get here, are the ones &lt;BR /&gt;
that I want to get in .NET.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
i.e.&lt;BR /&gt;
&lt;BR /&gt;
Select object: ((-1 . &lt;ENTITY ="" -51963e98=""&gt;) (0 . "INSERT") (5 . "29F5")&lt;BR /&gt;
&lt;BR /&gt;
(102 . "{ACAD_XDICTIONARY") (360 . &lt;ENTITY ="" -51963e90=""&gt;) (102 . "}") &lt;BR /&gt;
(330 .&lt;BR /&gt;
&lt;BR /&gt;
&lt;ENTITY ="" -4011f2f8=""&gt;) (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 .&lt;BR /&gt;
&lt;BR /&gt;
"ADE_TEMP") (100 . "AcDbBlockReference") (2 . "T61-5-2-0103") (10 128170.0&lt;BR /&gt;
&lt;BR /&gt;
49848.1 13599.3) (41 . 1.0) (42 . 1.0) (43 . 1.0) (50 . 1.5708) (70 . 0) (71 &lt;BR /&gt;
..&lt;BR /&gt;
&lt;BR /&gt;
0) (44 . 0.0) (45 . 0.0) (210 0.0 -0.258817 0.965926))&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Does anyone know the equivalent .NET command to get the Block References &lt;BR /&gt;
original insertion point (base point) which is the same as a the DXF 10 &lt;BR /&gt;
code?&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
In VBA I have noticed there is a object.BasePoint property however I do not &lt;BR /&gt;
know how to convert this to .NET.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Cheers,&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Kate&lt;/ENTITY&gt;&lt;/ENTITY&gt;&lt;/ENTITY&gt;&lt;/KWARMINGTON&gt;</description>
      <pubDate>Wed, 29 Apr 2009 07:38:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/base-point-location-of-block-reference/m-p/2477893#M70798</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-04-29T07:38:05Z</dc:date>
    </item>
    <item>
      <title>Re: Base Point Location of Block Reference</title>
      <link>https://forums.autodesk.com/t5/net-forum/base-point-location-of-block-reference/m-p/2477894#M70799</link>
      <description>Basically what is happening is we have a database store of Block Reference information, my application places the Xreferences according to the values we have stored and then monitors if the position/rotation/scale/extrusion of the Block Ref changes if the user accidently moves the item. If the item changes the Application alerts the user.&lt;BR /&gt;
&lt;BR /&gt;
The values we have stored are the initial Position of the object and any manipulation values of the object i.e. scale, rotation. Once the extrusion (3d rotate) of the item has been applied (using BlockRef.Normal), the position of the Block Ref (BlockRef.Position) changes which then appears as an alert in my application which is incorrect. The value that we store, and the value I need to do my comparison against is the original position the item was placed in, or the original insertion point of the object before 3d rotate occurred. &lt;BR /&gt;
&lt;BR /&gt;
When a user then commits the changes of the block reference back to our database, I need to store the values to recreate the current location of the object. So I need to store the position before the 3d rotate has occured so I can then recreate the position again by apply the series of values we store.</description>
      <pubDate>Thu, 30 Apr 2009 01:15:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/base-point-location-of-block-reference/m-p/2477894#M70799</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-04-30T01:15:37Z</dc:date>
    </item>
    <item>
      <title>Re: Base Point Location of Block Reference</title>
      <link>https://forums.autodesk.com/t5/net-forum/base-point-location-of-block-reference/m-p/2477895#M70800</link>
      <description>The insertion point returned by LISP's (entget) is in OCS (Object Coordinate&lt;BR /&gt;
System) coords.&lt;BR /&gt;
&lt;BR /&gt;
The Position property of the BlockReference is in WCS coords.&lt;BR /&gt;
&lt;BR /&gt;
To translate from one to the other, you can use the transformation matrix&lt;BR /&gt;
returned by the BlockReference's 'Ecs' property.&lt;BR /&gt;
&lt;BR /&gt;
You use the Point3d's TransformBy() method to do the transformation:&lt;BR /&gt;
&lt;BR /&gt;
{code}&lt;BR /&gt;
&lt;BR /&gt;
     BlockReference blkref = // set to a valid BlockReference&lt;BR /&gt;
&lt;BR /&gt;
     // Transform from WCS to OCS&lt;BR /&gt;
     Point3d OcsPosition =&lt;BR /&gt;
blkRef.Position.TransformBy(blkref.Ecs.Inverse() );&lt;BR /&gt;
&lt;BR /&gt;
     // Transform from OCS to WCS:&lt;BR /&gt;
     Point3d WcsPosition = OcsPosition.TransformBy(blkref.Ecs);&lt;BR /&gt;
&lt;BR /&gt;
{code}&lt;BR /&gt;
&lt;BR /&gt;
Using something like the above, OcsPosition should have the same value&lt;BR /&gt;
returned by the LISP (entget) function.&lt;BR /&gt;
&lt;BR /&gt;
If you're storing coordinates in an external datasource, it would probably &lt;BR /&gt;
be better to store WCS coordinates rather than OCS coordinates, as that &lt;BR /&gt;
would eliminate the need to do any transformations.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
http://www.caddzone.com&lt;BR /&gt;
&lt;BR /&gt;
AcadXTabs: MDI Document Tabs for AutoCAD 2009&lt;BR /&gt;
Supporting AutoCAD 2000 through 2009&lt;BR /&gt;
&lt;BR /&gt;
http://www.acadxtabs.com&lt;BR /&gt;
&lt;BR /&gt;
Introducing AcadXTabs 2010:&lt;BR /&gt;
http://www.caddzone.com/acadxtabs/AcadXTabs2010.htm&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;KWARMINGTON&gt; wrote in message news:6173525@discussion.autodesk.com...&lt;BR /&gt;
Basically what is happening is we have a database store of Block Reference&lt;BR /&gt;
information, my application places the Xreferences according to the values&lt;BR /&gt;
we have stored and then monitors if the position/rotation/scale/extrusion of&lt;BR /&gt;
the Block Ref changes if the user accidently moves the item. If the item&lt;BR /&gt;
changes the Application alerts the user. The values we have stored are the&lt;BR /&gt;
initial Position of the object and any manipulation values of the object&lt;BR /&gt;
i.e. scale, rotation. Once the extrusion (3d rotate) of the item has been&lt;BR /&gt;
applied (using BlockRef.Normal), the position of the Block Ref&lt;BR /&gt;
(BlockRef.Position) changes which then appears as an alert in my application&lt;BR /&gt;
which is incorrect. The value that we store, and the value I need to do my&lt;BR /&gt;
comparison against is the original position the item was placed in, or the&lt;BR /&gt;
original insertion point of the object before 3d rotate occurred. When a&lt;BR /&gt;
user then commits the changes of the block reference back to our database, I&lt;BR /&gt;
need to store the values to recreate the current location of the object. So&lt;BR /&gt;
I need to store the position before the 3d rotate has occured so I can then&lt;BR /&gt;
recreate the position again by apply the series of values we store.&lt;/KWARMINGTON&gt;</description>
      <pubDate>Thu, 30 Apr 2009 01:55:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/base-point-location-of-block-reference/m-p/2477895#M70800</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-04-30T01:55:12Z</dc:date>
    </item>
    <item>
      <title>Re: Base Point Location of Block Reference</title>
      <link>https://forums.autodesk.com/t5/net-forum/base-point-location-of-block-reference/m-p/2477896#M70801</link>
      <description>Thanks for your help Tony. &lt;BR /&gt;
&lt;BR /&gt;
I tried what you suggested however I still seem to be getting the same values. I used your example above and got the same values for both OcsPosition and WcsPosition.&lt;BR /&gt;
&lt;BR /&gt;
If i inspect the blockRef.BlockTransform.Inverse().Translation property, the values I want are there however they are in the wrong positions with the wrong +/-. &lt;BR /&gt;
i.e.&lt;BR /&gt;
-		Translation	{(-49848.06833,128170.1858,-13599.2677)}	Autodesk.AutoCAD.Geometry.Vector3d&lt;BR /&gt;
		LargestElement	1	int&lt;BR /&gt;
		Length	138193.22170864654	double&lt;BR /&gt;
		LengthSqrd	19097366526.215137	double&lt;BR /&gt;
		X	-49848.06833	double&lt;BR /&gt;
		Y	128170.1858	double&lt;BR /&gt;
		Z	-13599.267700000006	double&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Instead of transforming by the Ecs, should I be using the BlockTransform somehow?</description>
      <pubDate>Thu, 30 Apr 2009 06:35:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/base-point-location-of-block-reference/m-p/2477896#M70801</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-04-30T06:35:43Z</dc:date>
    </item>
    <item>
      <title>Re: Base Point Location of Block Reference</title>
      <link>https://forums.autodesk.com/t5/net-forum/base-point-location-of-block-reference/m-p/2477897#M70802</link>
      <description>The OCS and WCS coordinates are the same if the block lies in the XY plane &lt;BR /&gt;
and its normal is 0,0,1.&lt;BR /&gt;
&lt;BR /&gt;
You'll need to post a drawing and some sample code.&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
http://www.caddzone.com&lt;BR /&gt;
&lt;BR /&gt;
AcadXTabs: MDI Document Tabs for AutoCAD 2009&lt;BR /&gt;
Supporting AutoCAD 2000 through 2009&lt;BR /&gt;
&lt;BR /&gt;
http://www.acadxtabs.com&lt;BR /&gt;
&lt;BR /&gt;
Introducing AcadXTabs 2010:&lt;BR /&gt;
http://www.caddzone.com/acadxtabs/AcadXTabs2010.htm&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;KWARMINGTON&gt; wrote in message news:6173609@discussion.autodesk.com...&lt;BR /&gt;
Thanks for your help Tony. I tried what you suggested however I still seem &lt;BR /&gt;
to be getting the same values. I used your example above and got the same &lt;BR /&gt;
values for both OcsPosition and WcsPosition. If i inspect the &lt;BR /&gt;
blockRef.BlockTransform.Inverse().Translation property, the values I want &lt;BR /&gt;
are there however they are in the wrong positions with the wrong +/-. i.e. - &lt;BR /&gt;
Translation {(-49848.06833,128170.1858,-13599.2677)} &lt;BR /&gt;
Autodesk.AutoCAD.Geometry.Vector3d LargestElement 1 int Length &lt;BR /&gt;
138193.22170864654 double LengthSqrd 19097366526.215137 double &lt;BR /&gt;
X -49848.06833 double Y 128170.1858 double Z -13599.267700000006 double &lt;BR /&gt;
Instead of transforming by the Ecs, should I be using the BlockTransform &lt;BR /&gt;
somehow?&lt;/KWARMINGTON&gt;</description>
      <pubDate>Thu, 30 Apr 2009 07:42:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/base-point-location-of-block-reference/m-p/2477897#M70802</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-04-30T07:42:17Z</dc:date>
    </item>
    <item>
      <title>Re: Base Point Location of Block Reference</title>
      <link>https://forums.autodesk.com/t5/net-forum/base-point-location-of-block-reference/m-p/2477898#M70803</link>
      <description>I think I see the issue you’re describing.  The attached sample code continues with the BlockTransform method to retrieve coordinates as would be shown by group code 10.  &lt;BR /&gt;
&lt;BR /&gt;
It does seem like a more elegant solution should be available, however.</description>
      <pubDate>Thu, 30 Apr 2009 10:14:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/base-point-location-of-block-reference/m-p/2477898#M70803</guid>
      <dc:creator>SEANT61</dc:creator>
      <dc:date>2009-04-30T10:14:53Z</dc:date>
    </item>
    <item>
      <title>Re: Base Point Location of Block Reference</title>
      <link>https://forums.autodesk.com/t5/net-forum/base-point-location-of-block-reference/m-p/2477899#M70804</link>
      <description>I have attached the original drawing and will attach the drawing that I have Xref'd the drawing into in the next post ( I seem to be only able to attach one drawing).&lt;BR /&gt;
&lt;BR /&gt;
My code for placing the object is as follows.&lt;BR /&gt;
The values that are in item are - &lt;BR /&gt;
		Extrusion&lt;BR /&gt;
		CoordinateX	0.0	double&lt;BR /&gt;
		CoordinateY	-0.25881731	double&lt;BR /&gt;
		CoordinateZ	0.96592629	double&lt;BR /&gt;
		refPoint	{(128170.1858,49848.06833,13599.2677)}	Autodesk.AutoCAD.Geometry.Point3d&lt;BR /&gt;
		X	128170.1858	double&lt;BR /&gt;
		Y	49848.06833	double&lt;BR /&gt;
		Z	13599.2677	double	&lt;BR /&gt;
		Rotation	90.0	double&lt;BR /&gt;
		ScaleX	1.0	double&lt;BR /&gt;
		ScaleY	1.0	double&lt;BR /&gt;
		ScaleZ	1.0	double&lt;BR /&gt;
	&lt;BR /&gt;
&lt;BR /&gt;
{code}&lt;BR /&gt;
    // Get and store the current layer string&lt;BR /&gt;
                        string savedCurLayer = (string)CADApplicationServices.Application.GetSystemVariable("CLAYER");&lt;BR /&gt;
                        // Get and store the current ucs&lt;BR /&gt;
                        Matrix3d savedUCS = currentDoc.Editor.CurrentUserCoordinateSystem;&lt;BR /&gt;
                        currentDoc.Editor.CurrentUserCoordinateSystem = Matrix3d.Identity;&lt;BR /&gt;
&lt;BR /&gt;
                        reference = new CADDatabaseServices.BlockReference(refPoint, xrefId);&lt;BR /&gt;
                                                &lt;BR /&gt;
                        reference.Rotation = Math.PI * item.Rotation / 180.00;&lt;BR /&gt;
                        reference.ScaleFactors = new Scale3d(item.ScaleX, item.ScaleY, item.ScaleZ);&lt;BR /&gt;
                        &lt;BR /&gt;
                        var v = new Vector3d(item.Extrusion.CoordinateX, item.Extrusion.CoordinateY, item.Extrusion.CoordinateZ);                  &lt;BR /&gt;
                        reference.Normal = v;&lt;BR /&gt;
                     &lt;BR /&gt;
                        // Make the original layer active again:&lt;BR /&gt;
                        CADApplicationServices.Application.SetSystemVariable("CLAYER", savedCurLayer);&lt;BR /&gt;
&lt;BR /&gt;
                        // Restore the UCS:&lt;BR /&gt;
                        currentDoc.Editor.CurrentUserCoordinateSystem = savedUCS;&lt;BR /&gt;
&lt;BR /&gt;
                        record.AppendEntity(reference);&lt;BR /&gt;
                        trans.AddNewlyCreatedDBObject(reference, true);&lt;BR /&gt;
                        SetLayerForBlock(layerName, reference);&lt;BR /&gt;
&lt;BR /&gt;
                        ExtensionData.WriteBlockXRecord(reference, item);&lt;BR /&gt;
&lt;BR /&gt;
                        trans.Commit();&lt;BR /&gt;
{code}&lt;BR /&gt;
&lt;BR /&gt;
I then try and read the values back from the block once the item has been placed. BlockRef is a valid block Reference.&lt;BR /&gt;
The values I am getting are - &lt;BR /&gt;
+		OcsPosition	{(128170.1858,44629.8338736,26037.4331803939)}	Autodesk.AutoCAD.Geometry.Point3d&lt;BR /&gt;
+		WcsPosition	{(128170.1858,44629.8338736,26037.4331803939)}	Autodesk.AutoCAD.Geometry.Point3d&lt;BR /&gt;
+		zero	{(0,0,0)}	Autodesk.AutoCAD.Geometry.Point3d&lt;BR /&gt;
+		GCTp3d	{(49848.06833,-128170.1858,13599.2677)}	Autodesk.AutoCAD.Geometry.Point3d&lt;BR /&gt;
&lt;BR /&gt;
The values for the GCTp3d are the correct values, just in the wrong order and +/-.&lt;BR /&gt;
&lt;BR /&gt;
{code}&lt;BR /&gt;
   CADApplicationServices.Document currentDoc = CADApplicationServices.Application.DocumentManager.MdiActiveDocument;&lt;BR /&gt;
                Matrix3d savedUCS = currentDoc.Editor.CurrentUserCoordinateSystem;&lt;BR /&gt;
                currentDoc.Editor.CurrentUserCoordinateSystem = Matrix3d.Identity;&lt;BR /&gt;
&lt;BR /&gt;
                blockInDrawing.XReference = blockRef.Name;&lt;BR /&gt;
&lt;BR /&gt;
                // Transform from WCS to OCS  -- this gives me the same values as blockRef.Position&lt;BR /&gt;
                Point3d OcsPosition = blockRef.Position.TransformBy(blockRef.Ecs.Inverse());&lt;BR /&gt;
&lt;BR /&gt;
                // Transform from OCS to WCS -- this gives me the same values as blockRef.Position&lt;BR /&gt;
                Point3d WcsPosition = OcsPosition.TransformBy(blockRef.Ecs);&lt;BR /&gt;
&lt;BR /&gt;
                //this gives me the correct values, but in the wrong positions with the wrong +/-&lt;BR /&gt;
                Point3d zero = new Point3d();&lt;BR /&gt;
                Point3d GCTp3d = zero - zero.TransformBy(blockRef.BlockTransform.Inverse()).GetAsVector();&lt;BR /&gt;
&lt;BR /&gt;
                blockInDrawing.InsertionPoint.CoordinateX = Math.Round(GCTp3d.X, 8);&lt;BR /&gt;
                blockInDrawing.InsertionPoint.CoordinateY = Math.Round(GCTp3d.Y, 8);&lt;BR /&gt;
                blockInDrawing.InsertionPoint.CoordinateZ = Math.Round(GCTp3d.Z, 8);&lt;BR /&gt;
                //blockInDrawing.InsertionPoint.CoordinateX = Math.Round(blockRef.Position.X, 8);&lt;BR /&gt;
                //blockInDrawing.InsertionPoint.CoordinateY = Math.Round(blockRef.Position.Y, 8);&lt;BR /&gt;
                //blockInDrawing.InsertionPoint.CoordinateZ = Math.Round(blockRef.Position.Z, 8);&lt;BR /&gt;
&lt;BR /&gt;
                blockInDrawing.ScaleX = blockRef.ScaleFactors.X;&lt;BR /&gt;
                blockInDrawing.ScaleY = blockRef.ScaleFactors.Y;&lt;BR /&gt;
                blockInDrawing.ScaleZ = blockRef.ScaleFactors.Z;&lt;BR /&gt;
                blockInDrawing.Rotation = Math.Round(180.00 * blockRef.Rotation / Math.PI, 8);&lt;BR /&gt;
                &lt;BR /&gt;
                blockInDrawing.Extrusion.CoordinateX = Math.Round(blockRef.Normal.X, 8);&lt;BR /&gt;
                blockInDrawing.Extrusion.CoordinateY = Math.Round(blockRef.Normal.Y, 8);&lt;BR /&gt;
                blockInDrawing.Extrusion.CoordinateZ = Math.Round(blockRef.Normal.Z, 8);&lt;BR /&gt;
&lt;BR /&gt;
                // Restore the UCS:&lt;BR /&gt;
                currentDoc.Editor.CurrentUserCoordinateSystem = savedUCS;&lt;BR /&gt;
{code}&lt;BR /&gt;
&lt;BR /&gt;
I dont actually use AutoCad at all, so I am not very familar with the way blocks get rotated etc. Hopefully this is something really basic that I am just missing.&lt;BR /&gt;
&lt;BR /&gt;
Thanks for all your help &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;
&lt;BR /&gt;
Kate

Edited by: kwarmington on Apr 30, 2009 11:16 PM</description>
      <pubDate>Thu, 30 Apr 2009 23:16:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/base-point-location-of-block-reference/m-p/2477899#M70804</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-04-30T23:16:23Z</dc:date>
    </item>
    <item>
      <title>Re: Base Point Location of Block Reference</title>
      <link>https://forums.autodesk.com/t5/net-forum/base-point-location-of-block-reference/m-p/2477900#M70805</link>
      <description>I have attached the file that I have Xref'd the block into using the code above.&lt;BR /&gt;
&lt;BR /&gt;
Cheers,&lt;BR /&gt;
&lt;BR /&gt;
Kate</description>
      <pubDate>Thu, 30 Apr 2009 23:29:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/base-point-location-of-block-reference/m-p/2477900#M70805</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-04-30T23:29:57Z</dc:date>
    </item>
    <item>
      <title>Re: Base Point Location of Block Reference</title>
      <link>https://forums.autodesk.com/t5/net-forum/base-point-location-of-block-reference/m-p/2477901#M70806</link>
      <description>From your earlier post:  &lt;EM&gt;So I place the block Reference at the correct position I change the block reference's extrusion using Blockref.Normal {color:#0000ff}which in turn gives it a new position.{color}&lt;BR /&gt;&lt;BR /&gt;&lt;/EM&gt;I also have a lot of blocks that I insert with normals that are not (0,0,1), and I thought it worth mentioning that in my code I simply set the position property after setting the normal. Technically I'm Re-setting the position, since it is set first in the New constructor of BlockReference.</description>
      <pubDate>Thu, 30 Apr 2009 23:30:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/base-point-location-of-block-reference/m-p/2477901#M70806</guid>
      <dc:creator>chiefbraincloud</dc:creator>
      <dc:date>2009-04-30T23:30:01Z</dc:date>
    </item>
    <item>
      <title>Re: Base Point Location of Block Reference</title>
      <link>https://forums.autodesk.com/t5/net-forum/base-point-location-of-block-reference/m-p/2477902#M70807</link>
      <description>I have tried that, however the AutoCad guy here at work had a look at where the block had been placed, and said it was now in the wrong position.&lt;BR /&gt;
&lt;BR /&gt;
The values we store are the WCS coordinates for the item. If I place the item and then apply the values for the Normal and then apply the position again, the block wont be in the correct position. It will have been placed, moved, and then moved again. The position that I'm placing the item in is correct (as far as I can tell), I just want to somehow read the values back where it was originally placed.</description>
      <pubDate>Thu, 30 Apr 2009 23:44:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/base-point-location-of-block-reference/m-p/2477902#M70807</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-04-30T23:44:43Z</dc:date>
    </item>
    <item>
      <title>Re: Base Point Location of Block Reference</title>
      <link>https://forums.autodesk.com/t5/net-forum/base-point-location-of-block-reference/m-p/2477903#M70808</link>
      <description>Even more lacking in elegancy, but:&lt;BR /&gt;
&lt;BR /&gt;
                Point3d zero = new Point3d();&lt;BR /&gt;
&lt;BR /&gt;
                Point3d GCTp3d = zero - zero.TransformBy(br.BlockTransform.Inverse()).GetAsVector();//Crux&lt;BR /&gt;
&lt;BR /&gt;
                GCTp3d = GCTp3d.RotateBy(br.Rotation, new Vector3d(0.0,0.0,1.0),zero);</description>
      <pubDate>Fri, 01 May 2009 02:30:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/base-point-location-of-block-reference/m-p/2477903#M70808</guid>
      <dc:creator>SEANT61</dc:creator>
      <dc:date>2009-05-01T02:30:16Z</dc:date>
    </item>
    <item>
      <title>Re: Base Point Location of Block Reference</title>
      <link>https://forums.autodesk.com/t5/net-forum/base-point-location-of-block-reference/m-p/2477904#M70809</link>
      <description>Thank you so much.&lt;BR /&gt;
&lt;BR /&gt;
This has done the trick &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
      <pubDate>Fri, 01 May 2009 04:00:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/base-point-location-of-block-reference/m-p/2477904#M70809</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-05-01T04:00:17Z</dc:date>
    </item>
    <item>
      <title>Re: Base Point Location of Block Reference</title>
      <link>https://forums.autodesk.com/t5/net-forum/base-point-location-of-block-reference/m-p/2477905#M70810</link>
      <description>Oh for cry'n out loud.....&lt;BR /&gt;
&lt;BR /&gt;
That has got to be the most long-winded, roundabout attempt to ask little &lt;BR /&gt;
more than "how do I rotate a block reference about its insertion point, so &lt;BR /&gt;
that its new normal is parallel to a given vector" ?&lt;BR /&gt;
&lt;BR /&gt;
Sheesh !&lt;BR /&gt;
&lt;BR /&gt;
   http://www.caddzone.com/Rotate3d.cs&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
http://www.caddzone.com&lt;BR /&gt;
&lt;BR /&gt;
AcadXTabs: MDI Document Tabs for AutoCAD 2009&lt;BR /&gt;
Supporting AutoCAD 2000 through 2009&lt;BR /&gt;
&lt;BR /&gt;
http://www.acadxtabs.com&lt;BR /&gt;
&lt;BR /&gt;
Introducing AcadXTabs 2010:&lt;BR /&gt;
http://www.caddzone.com/acadxtabs/AcadXTabs2010.htm&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;KWARMINGTON&gt; wrote in message news:6174653@discussion.autodesk.com...&lt;BR /&gt;
Thank you so much. This has done the trick &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/KWARMINGTON&gt;</description>
      <pubDate>Fri, 01 May 2009 08:34:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/base-point-location-of-block-reference/m-p/2477905#M70810</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-05-01T08:34:47Z</dc:date>
    </item>
    <item>
      <title>Re: Base Point Location of Block Reference</title>
      <link>https://forums.autodesk.com/t5/net-forum/base-point-location-of-block-reference/m-p/2477906#M70811</link>
      <description>Thanks for putting up with my long winded question. &lt;BR /&gt;
&lt;BR /&gt;
If only I knew that's what I wanted to ask, I could have saved everyone a heap of trouble.&lt;BR /&gt;
&lt;BR /&gt;
Hopefully next time ill know what I'm trying to do &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
      <pubDate>Fri, 01 May 2009 08:52:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/base-point-location-of-block-reference/m-p/2477906#M70811</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-05-01T08:52:57Z</dc:date>
    </item>
    <item>
      <title>Re: Base Point Location of Block Reference</title>
      <link>https://forums.autodesk.com/t5/net-forum/base-point-location-of-block-reference/m-p/2477907#M70812</link>
      <description>Kate - No problem.&lt;BR /&gt;
&lt;BR /&gt;
It's not uncommon for folks to first try to solve a problem themselves, and &lt;BR /&gt;
then come here and make the mistake of describing the problem by presenting &lt;BR /&gt;
their attempt to solve it.&lt;BR /&gt;
&lt;BR /&gt;
In other words, you don't rotate an object by changing its Normal property, &lt;BR /&gt;
you you just use its TransformBy() method with the required matrix, which &lt;BR /&gt;
the sample I published shows how to get.&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
http://www.caddzone.com&lt;BR /&gt;
&lt;BR /&gt;
AcadXTabs: MDI Document Tabs for AutoCAD 2009&lt;BR /&gt;
Supporting AutoCAD 2000 through 2009&lt;BR /&gt;
&lt;BR /&gt;
http://www.acadxtabs.com&lt;BR /&gt;
&lt;BR /&gt;
Introducing AcadXTabs 2010:&lt;BR /&gt;
http://www.caddzone.com/acadxtabs/AcadXTabs2010.htm&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;KWARMINGTON&gt; wrote in message news:6174669@discussion.autodesk.com...&lt;BR /&gt;
Thanks for putting up with my long winded question. If only I knew that's &lt;BR /&gt;
what I wanted to ask, I could have saved everyone a heap of trouble. &lt;BR /&gt;
Hopefully next time ill know what I'm trying to do &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/KWARMINGTON&gt;</description>
      <pubDate>Fri, 01 May 2009 09:03:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/base-point-location-of-block-reference/m-p/2477907#M70812</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-05-01T09:03:16Z</dc:date>
    </item>
    <item>
      <title>Re: Base Point Location of Block Reference</title>
      <link>https://forums.autodesk.com/t5/net-forum/base-point-location-of-block-reference/m-p/2477908#M70813</link>
      <description>Now the question is still in question, to me at least.  Was the ultimate objective to change the orientation of the reference from how it is in “Drawing_with_xref.dwg”?  &lt;BR /&gt;
&lt;BR /&gt;
Or, to return a Point3d to use as comparison with a DXF Group code 10 reading, perhaps stored as some database entry?</description>
      <pubDate>Fri, 01 May 2009 09:33:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/base-point-location-of-block-reference/m-p/2477908#M70813</guid>
      <dc:creator>SEANT61</dc:creator>
      <dc:date>2009-05-01T09:33:29Z</dc:date>
    </item>
    <item>
      <title>Re: Base Point Location of Block Reference</title>
      <link>https://forums.autodesk.com/t5/net-forum/base-point-location-of-block-reference/m-p/2477909#M70814</link>
      <description>i think it was  to do : &lt;BR /&gt;
&lt;BR /&gt;
&amp;gt; {quote:title=seant61 wrote:}{quote}&lt;BR /&gt;
&amp;gt; Or, to return a Point3d to use as comparison with a DXF Group code 10 reading, perhaps stored as some database entry?&lt;BR /&gt;
&lt;BR /&gt;
Which I achieved by the code you posted ( I am no longer at work and have not tried what Tony posted).&lt;BR /&gt;
&lt;BR /&gt;
I didn't want to manipulate the block at all, only get the information to compare with the original placement values.</description>
      <pubDate>Fri, 01 May 2009 13:12:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/base-point-location-of-block-reference/m-p/2477909#M70814</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-05-01T13:12:32Z</dc:date>
    </item>
  </channel>
</rss>

