<?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 Unable to change Point3d value in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/unable-to-change-point3d-value/m-p/5664367#M39733</link>
    <description>&lt;P&gt;Good morning,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have multiple 3D objects that I'm trying to change the Location.Z value for. &amp;nbsp;Unfortuantely, in this paticular situation I cannot seem to get the location value to change. &amp;nbsp;When I do use this exact method when handling one object at a time, it works, but it won't for multiple objects.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Basically, everytime the user moves their cursor and changes the point, we activate the PointMonitorListener to get the current point where their cursor resides along the Z axis. &amp;nbsp;Once we get that point, we go through and update the preview for each object that we have selected to modify.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The issue is when we get to hangerItem.Location = new Point3d(). &amp;nbsp;I cannot get that value to change for the Location.Z axis.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope this is clear enough to understand, if there are any questions I will be monitoring this thread.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;   public void PointMonitorListener(object sender, PointMonitorEventArgs e)
        {
            // Get the point
            Point3d pt = e.Context.ComputedPoint;
            // Update our graphics and the current point
            for (int i = 0; i &amp;lt; PartUtils.partList.Count; i++)
            {
                UpdateTransGraphics(PartUtils.partList[i], pt);
            }
        }

        public void UpdateTransGraphics(Part3d hangerItem, Point3d pt)
        {
            jigType = JigType.MoveLower;
            Hanger hanger = null;
            Part3d newHangerItem;

            switch (jigType)
            {
              
                case JigType.MoveLower:
                    {
                        if (double.IsNaN(pt.Z))
                        {
                            break;
                        }

                        double dz = pt.Z - hangerItem.Location.Z;

                        hangerItem.Location = new Point3d(
                            hangerItem.Location.X,
                            hangerItem.Location.Y,
                            hangerItem.Location.Z + dz);

                     
                        hanger = (Hanger)newHangerItem;

                        // Find the lowest Z value among the lower attachment locations
                        double minZ = double.MaxValue;
                        foreach (Part3d lower in hanger.Lowers)
                        {
                            if (lower.TopLocation.Z &amp;lt; minZ)
                            {
                                minZ = lower.TopLocation.Z;
                            }
                        }

                        // Recalculate the hanger arm lengths
                        foreach (Part3d arm in hanger.Arms)
                        {
                            Point3d endPt = arm.Location + (arm.Direction * arm.Length);
                            endPt = new Point3d(endPt.X, endPt.Y, minZ);
                            Vector3d lenVec = arm.Location.GetVectorTo(endPt);
                            if (lenVec.Length &amp;gt; arm.MinLength)
                            {
                                arm.Length = lenVec.Length;
                            }
                        }

                        break;
                    }
                

            if (solid != null &amp;amp;&amp;amp; !solid.IsDisposed)
            {
                TransientManager.CurrentTransientManager.EraseTransient(solid, new IntegerCollection());
                solid.Dispose();
            }
            solid = hanger.CreateSolidPreview();
            TransientManager.CurrentTransientManager.AddTransient(solid, TransientDrawingMode.DirectShortTerm, 128, new IntegerCollection());
        }&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 04 Jun 2015 13:30:43 GMT</pubDate>
    <dc:creator>mhillis</dc:creator>
    <dc:date>2015-06-04T13:30:43Z</dc:date>
    <item>
      <title>Unable to change Point3d value</title>
      <link>https://forums.autodesk.com/t5/net-forum/unable-to-change-point3d-value/m-p/5664367#M39733</link>
      <description>&lt;P&gt;Good morning,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have multiple 3D objects that I'm trying to change the Location.Z value for. &amp;nbsp;Unfortuantely, in this paticular situation I cannot seem to get the location value to change. &amp;nbsp;When I do use this exact method when handling one object at a time, it works, but it won't for multiple objects.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Basically, everytime the user moves their cursor and changes the point, we activate the PointMonitorListener to get the current point where their cursor resides along the Z axis. &amp;nbsp;Once we get that point, we go through and update the preview for each object that we have selected to modify.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The issue is when we get to hangerItem.Location = new Point3d(). &amp;nbsp;I cannot get that value to change for the Location.Z axis.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope this is clear enough to understand, if there are any questions I will be monitoring this thread.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;   public void PointMonitorListener(object sender, PointMonitorEventArgs e)
        {
            // Get the point
            Point3d pt = e.Context.ComputedPoint;
            // Update our graphics and the current point
            for (int i = 0; i &amp;lt; PartUtils.partList.Count; i++)
            {
                UpdateTransGraphics(PartUtils.partList[i], pt);
            }
        }

        public void UpdateTransGraphics(Part3d hangerItem, Point3d pt)
        {
            jigType = JigType.MoveLower;
            Hanger hanger = null;
            Part3d newHangerItem;

            switch (jigType)
            {
              
                case JigType.MoveLower:
                    {
                        if (double.IsNaN(pt.Z))
                        {
                            break;
                        }

                        double dz = pt.Z - hangerItem.Location.Z;

                        hangerItem.Location = new Point3d(
                            hangerItem.Location.X,
                            hangerItem.Location.Y,
                            hangerItem.Location.Z + dz);

                     
                        hanger = (Hanger)newHangerItem;

                        // Find the lowest Z value among the lower attachment locations
                        double minZ = double.MaxValue;
                        foreach (Part3d lower in hanger.Lowers)
                        {
                            if (lower.TopLocation.Z &amp;lt; minZ)
                            {
                                minZ = lower.TopLocation.Z;
                            }
                        }

                        // Recalculate the hanger arm lengths
                        foreach (Part3d arm in hanger.Arms)
                        {
                            Point3d endPt = arm.Location + (arm.Direction * arm.Length);
                            endPt = new Point3d(endPt.X, endPt.Y, minZ);
                            Vector3d lenVec = arm.Location.GetVectorTo(endPt);
                            if (lenVec.Length &amp;gt; arm.MinLength)
                            {
                                arm.Length = lenVec.Length;
                            }
                        }

                        break;
                    }
                

            if (solid != null &amp;amp;&amp;amp; !solid.IsDisposed)
            {
                TransientManager.CurrentTransientManager.EraseTransient(solid, new IntegerCollection());
                solid.Dispose();
            }
            solid = hanger.CreateSolidPreview();
            TransientManager.CurrentTransientManager.AddTransient(solid, TransientDrawingMode.DirectShortTerm, 128, new IntegerCollection());
        }&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jun 2015 13:30:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/unable-to-change-point3d-value/m-p/5664367#M39733</guid>
      <dc:creator>mhillis</dc:creator>
      <dc:date>2015-06-04T13:30:43Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to change Point3d value</title>
      <link>https://forums.autodesk.com/t5/net-forum/unable-to-change-point3d-value/m-p/5666912#M39734</link>
      <description>I'm not sure which API is this, more specifically the Part3d object. Can you clarify?</description>
      <pubDate>Fri, 05 Jun 2015 19:37:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/unable-to-change-point3d-value/m-p/5666912#M39734</guid>
      <dc:creator>augusto.goncalves</dc:creator>
      <dc:date>2015-06-05T19:37:05Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to change Point3d value</title>
      <link>https://forums.autodesk.com/t5/net-forum/unable-to-change-point3d-value/m-p/5666953#M39735</link>
      <description>I apologize for not clarifying that, the Part3d is a class we created for our objects. It inherits the standard AutoCAD API Point3d value for it's location type. Which is where I'm having the issue changing.</description>
      <pubDate>Fri, 05 Jun 2015 20:10:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/unable-to-change-point3d-value/m-p/5666953#M39735</guid>
      <dc:creator>mhillis</dc:creator>
      <dc:date>2015-06-05T20:10:04Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to change Point3d value</title>
      <link>https://forums.autodesk.com/t5/net-forum/unable-to-change-point3d-value/m-p/5666959#M39736</link>
      <description>&lt;P&gt;&lt;FONT face="courier new,courier"&gt;appears that you want to modify Solid3d's - if so, what displacement matrix are you applying to each of the solids?&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;for example, to change the z' location of a solid, one can pass a vector in example:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;var location = new Vector3d(0, 0, 96.0);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;var displacement = Matrix3d.Displacement(location);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;solid.TransformBy(displacement);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;hth.-&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Jun 2015 20:22:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/unable-to-change-point3d-value/m-p/5666959#M39736</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-06-05T20:22:14Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to change Point3d value</title>
      <link>https://forums.autodesk.com/t5/net-forum/unable-to-change-point3d-value/m-p/5666962#M39737</link>
      <description>Thanks for that.&lt;BR /&gt;&lt;BR /&gt;Note the Point3d class in AutoCAD API is immutable, therefore you cannot change it, only assign a new value. So you need to assign a new Point3d.&lt;BR /&gt;&lt;BR /&gt;Hope this is what you need.</description>
      <pubDate>Fri, 05 Jun 2015 20:23:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/unable-to-change-point3d-value/m-p/5666962#M39737</guid>
      <dc:creator>augusto.goncalves</dc:creator>
      <dc:date>2015-06-05T20:23:14Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to change Point3d value</title>
      <link>https://forums.autodesk.com/t5/net-forum/unable-to-change-point3d-value/m-p/5667678#M39738</link>
      <description>&lt;P&gt;^just to clarify since its common issue for us beginner programmers (had the same problem when I started)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;this does not work:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;obj.Point3d.X =5;
obj.Point3d.Y=5;&lt;/PRE&gt;
&lt;P&gt;.X; .Y; .Z values are reserved and can not be changed. But you can change the "point" - their&amp;nbsp;"parent" object; like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;to change &amp;nbsp;the point value;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;//FIRST CREATE TEMPORARY POINT WITH DESIRED VALUES
point3d tempPoint = new Point3d(5,5,0);
//REPLACE THE OLD POINT WITH NEW ONE
obj.Point3d = tempPoint;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 07 Jun 2015 15:29:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/unable-to-change-point3d-value/m-p/5667678#M39738</guid>
      <dc:creator>5thSth</dc:creator>
      <dc:date>2015-06-07T15:29:59Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to change Point3d value</title>
      <link>https://forums.autodesk.com/t5/net-forum/unable-to-change-point3d-value/m-p/5670598#M39739</link>
      <description>&lt;P&gt;I tried creating a new value and then assigning it to the old point as 5thSth described, but unfortunately, that did not work.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jun 2015 18:20:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/unable-to-change-point3d-value/m-p/5670598#M39739</guid>
      <dc:creator>mhillis</dc:creator>
      <dc:date>2015-06-09T18:20:25Z</dc:date>
    </item>
  </channel>
</rss>

