<?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: How to see if a Point Label has been moved to Dragged State in Civil 3D Customization Forum</title>
    <link>https://forums.autodesk.com/t5/civil-3d-customization-forum/how-to-see-if-a-point-label-has-been-moved-to-dragged-state/m-p/9665579#M8090</link>
    <description>&lt;P&gt;Here is the LISP:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;(defun c:DES_PtExpWithdragLoc ( / )
(vl-load-com)
(getdoc)

(vl-cmdf "netload" "C:\\Data\\_Autodesk Custom\\C3DLispTools.dll");load the dll that Jeff Mishler wrote. Thanks, Jeff!
(setq fl (open (strcat (filenamegetter) "_withDragStateLocation.txt") "w"))
(write-line "PtNumber, Easting, Northing, Elevation, Raw Description, IsDragged, Dragx, Draxy, Dragz" fl)
(setq pts (vlax-get c3ddoc 'Points)
	  cnt (vlax-get pts 'Count)
	  ctr 0)
	  
	  (while (&amp;lt; ctr cnt)
		(setq pt (vlax-invoke pts 'Item ctr)
			  pte (vlax-vla-object-&amp;gt;ename pt)
			  East (vlax-get pt 'Easting)
			  North (vlax-get pt 'Northing)
			  Elev (vlax-get pt 'Elevation)
			  RawDs (vlax-get pt 'RawDescription)
			  Num (vlax-get pt 'Number)
			  )
			  
			  (if (islabeldragged pte)
					(progn
						(setq LblLoc (pointlabellocation pte)
							  lblX (car lblloc)
							  lblY (cadr lblloc)
							  lblZ (caddr lblloc)
							  )
					(setq Dragged 1)
					)
					(setq Dragged 0)
					)
					(if (= dragged 1)
						(write-line (strcat (rtos num 2 0) "," (rtos east 2 4) "," (rtos north 2 4) "," (rtos Elev 2 3) "," RawDs "," (itoa dragged) "," (rtos lblx 2 4) ","
											(rtos lbly 2 4) "," (rtos lblz 2 4))
									fl)
						(write-line (strcat (rtos num 2 0) "," (rtos east 2 4) "," (rtos north 2 4) "," 
											(rtos Elev 2 3) "," RawDs "," (itoa dragged))
									fl)
					)
			
			(setq ctr (1+ ctr))
			)
			(close fl)
			(princ)
			)


(defun filenamegetter ( / pref)
  (setq pref (getvar "DWGPREFIX")
	dwgnm (substr (getvar "dwgname") 1 (- (strlen (getvar "dwgname")) 4))
	)
  (setq dwgnm (strcat pref dwgnm))
  )




;thanks to Jeff Mishler for the following code.  
(defun getAecAppNumber (/ );c3dnumber c3dproduct c3drelease)
  (setq	C3Dproduct (strcat "HKEY_LOCAL_MACHINE\\"
			   (if vlax-user-product-key
			     (vlax-user-product-key)
			     (vlax-product-key)
			   )
		   )
	C3Drelease (vl-registry-read C3Dproduct "Release")
	C3Dnumber  (substr
		     C3Drelease
		     1
		     (vl-string-search
		       "."
		       C3Drelease
		       (+ (vl-string-search "." C3Drelease) 1)
		     )
		   )
  )
)

(defun getdoc ( / )

  (setq appno (getaecappnumber))

  (setq	acadapp	(vlax-get-acad-object)
	c3dapp	(vla-getinterfaceobject acadapp (strcat "AeccXUiLand.AeccApplication." appno))
	C3Ddoc	(vla-get-activedocument C3Dapp)
  )

)					;end function&lt;/LI-CODE&gt;</description>
    <pubDate>Fri, 31 Jul 2020 02:21:37 GMT</pubDate>
    <dc:creator>tcorey</dc:creator>
    <dc:date>2020-07-31T02:21:37Z</dc:date>
    <item>
      <title>How to see if a Point Label has been moved to Dragged State</title>
      <link>https://forums.autodesk.com/t5/civil-3d-customization-forum/how-to-see-if-a-point-label-has-been-moved-to-dragged-state/m-p/9658645#M8084</link>
      <description>&lt;P&gt;Hello. Here's a rooking LISP question.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I can access a COGO Point with Visual LISP. It shows the label style, but there doesn't appear to be a way to evaluate the label. If the label is in dragged state, I want to be able to record the label location, hoping that, once written out to csv, I can import to another drawing, with edits intact.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jul 2020 01:10:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/civil-3d-customization-forum/how-to-see-if-a-point-label-has-been-moved-to-dragged-state/m-p/9658645#M8084</guid>
      <dc:creator>tcorey</dc:creator>
      <dc:date>2020-07-28T01:10:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to see if a Point Label has been moved to Dragged State</title>
      <link>https://forums.autodesk.com/t5/civil-3d-customization-forum/how-to-see-if-a-point-label-has-been-moved-to-dragged-state/m-p/9659950#M8085</link>
      <description>You can do this using the .NET API but not COM.</description>
      <pubDate>Tue, 28 Jul 2020 15:19:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/civil-3d-customization-forum/how-to-see-if-a-point-label-has-been-moved-to-dragged-state/m-p/9659950#M8085</guid>
      <dc:creator>Jeff_M</dc:creator>
      <dc:date>2020-07-28T15:19:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to see if a Point Label has been moved to Dragged State</title>
      <link>https://forums.autodesk.com/t5/civil-3d-customization-forum/how-to-see-if-a-point-label-has-been-moved-to-dragged-state/m-p/9660169#M8086</link>
      <description>&lt;P&gt;Thanks, Jeff. I had a hunch this might be the case. Bummer.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jul 2020 16:48:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/civil-3d-customization-forum/how-to-see-if-a-point-label-has-been-moved-to-dragged-state/m-p/9660169#M8086</guid>
      <dc:creator>tcorey</dc:creator>
      <dc:date>2020-07-28T16:48:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to see if a Point Label has been moved to Dragged State</title>
      <link>https://forums.autodesk.com/t5/civil-3d-customization-forum/how-to-see-if-a-point-label-has-been-moved-to-dragged-state/m-p/9660812#M8087</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/47135"&gt;@tcorey&lt;/a&gt;&amp;nbsp;Tim, I've been messing around with this and have this working:&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;;;Select a Point
(setq pt (car (entsel "Select point:")))
;;Check if it is dragged
(setq test (islabeldragged pt))
;;get the label location
(setq loc (pointlabellocation pt))
;;set a new label location, returns T if successful
(setq moved (pointlabellocation pt '(4332.33 3941.84 648.374)))
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The results running in the VLIDE:&lt;/P&gt;
&lt;P&gt;_$ (setq pt (car (entsel "Select point:")))&lt;BR /&gt;&amp;lt;Entity name: 2e6775cf890&amp;gt;&lt;BR /&gt;_$ (setq test (islabeldragged pt))&lt;BR /&gt;T&lt;/P&gt;
&lt;P&gt;_$ (setq loc (pointlabellocation pt))&lt;BR /&gt;(4288.39 3899.92 648.374)&lt;/P&gt;
&lt;P&gt;_$ (setq moved (pointlabellocation pt '(4332.33 3941.84 648.374)))&lt;BR /&gt;T&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I will be cleaning up the code and compiling it to post soon.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jul 2020 21:57:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/civil-3d-customization-forum/how-to-see-if-a-point-label-has-been-moved-to-dragged-state/m-p/9660812#M8087</guid>
      <dc:creator>Jeff_M</dc:creator>
      <dc:date>2020-07-28T21:57:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to see if a Point Label has been moved to Dragged State</title>
      <link>https://forums.autodesk.com/t5/civil-3d-customization-forum/how-to-see-if-a-point-label-has-been-moved-to-dragged-state/m-p/9660859#M8088</link>
      <description>&lt;P&gt;Attached is a ZIP with the compiled assembly. Be sure to Unblock the ZIP after downloading, extract the DLL file to a location you can later find it. Netload it into C3D, then the 2 lisp functions will be available.&lt;/P&gt;
&lt;P&gt;(IsLabelDragged ent)&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(PointLabelLocation ent)&lt;/P&gt;
&lt;P&gt;(PointLabelLocation ent pt3d)&lt;/P&gt;
&lt;P&gt;where ent must be the ENAME of a CogoPoint and pt3d must be a list of 3 doubles:&amp;nbsp; (x y z)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's the code for anyone that would like to see it:&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;using System;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.Geometry;
using Autodesk.Civil.DatabaseServices;

namespace C3DLispTools
{
    public class CogoPointFunctions
    {
        [LispFunction("IsLabelDragged")]
        public object IsLabelDragged(ResultBuffer rbfArgs)
        {
            try
            {
                Database db = Application.DocumentManager.MdiActiveDocument.Database;
                using (Transaction tr = db.TransactionManager.StartTransaction())
                {
                    var arInputArgs = rbfArgs.AsArray();
                    TypedValue tv = (TypedValue)arInputArgs.GetValue(0);
                    ObjectId objId = (ObjectId)tv.Value;

                    CogoPoint pt = objId.GetObject(OpenMode.ForRead) as CogoPoint;
                    if (pt == null)
                        return "Error: Not a CogoPoint!";

                    return pt.IsLabelDragged;
                }
            }
            catch
            {
                return LispDataType.Nil;

            }
        }

        [LispFunction("PointLabelLocation")]
        public object PointLabelLocation(ResultBuffer rbfArgs)
        {
            object retval = null;
            Database db = Application.DocumentManager.MdiActiveDocument.Database;
            using (Transaction tr = db.TransactionManager.StartTransaction())
            {
                var arInputArgs = rbfArgs.AsArray();
                TypedValue tv = (TypedValue)arInputArgs.GetValue(0);
                ObjectId objId = (ObjectId)tv.Value;

                CogoPoint pt = objId.GetObject(OpenMode.ForRead) as CogoPoint;
                if (pt == null)
                    retval = "Error: Not a CogoPoint!";
                else if (arInputArgs.Length == 1)
                    retval = pt.LabelLocation;
                else
                {
                    try
                    {
                        pt.UpgradeOpen();
                        tv = (TypedValue)arInputArgs.GetValue(1);
                        var ptlocation = (Point3d)tv.Value;
                        pt.ResetLabelLocation();
                        pt.LabelLocation = ptlocation;
                        pt.DowngradeOpen();
                        retval = true;
                    }
                    catch
                    {
                        retval = false;
                    }
                }
                tr.Commit();
                db.TransactionManager.QueueForGraphicsFlush();
            }
            return retval;
        }
    }
}
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jul 2020 22:37:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/civil-3d-customization-forum/how-to-see-if-a-point-label-has-been-moved-to-dragged-state/m-p/9660859#M8088</guid>
      <dc:creator>Jeff_M</dc:creator>
      <dc:date>2020-07-28T22:37:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to see if a Point Label has been moved to Dragged State</title>
      <link>https://forums.autodesk.com/t5/civil-3d-customization-forum/how-to-see-if-a-point-label-has-been-moved-to-dragged-state/m-p/9665572#M8089</link>
      <description>&lt;P&gt;Hi &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/32637"&gt;@Jeff_M&lt;/a&gt;&amp;nbsp;Thanks to your dll, I was able to create a lisp that exports points to a text file. There is a column that tells if the point label has been dragged and, if it has, then columns for label location x, y, and z. Now I intend to write a lisp that imports the points and applies the dragged location. Fun stuff!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt; &lt;/P&gt;</description>
      <pubDate>Fri, 31 Jul 2020 02:13:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/civil-3d-customization-forum/how-to-see-if-a-point-label-has-been-moved-to-dragged-state/m-p/9665572#M8089</guid>
      <dc:creator>tcorey</dc:creator>
      <dc:date>2020-07-31T02:13:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to see if a Point Label has been moved to Dragged State</title>
      <link>https://forums.autodesk.com/t5/civil-3d-customization-forum/how-to-see-if-a-point-label-has-been-moved-to-dragged-state/m-p/9665579#M8090</link>
      <description>&lt;P&gt;Here is the LISP:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;(defun c:DES_PtExpWithdragLoc ( / )
(vl-load-com)
(getdoc)

(vl-cmdf "netload" "C:\\Data\\_Autodesk Custom\\C3DLispTools.dll");load the dll that Jeff Mishler wrote. Thanks, Jeff!
(setq fl (open (strcat (filenamegetter) "_withDragStateLocation.txt") "w"))
(write-line "PtNumber, Easting, Northing, Elevation, Raw Description, IsDragged, Dragx, Draxy, Dragz" fl)
(setq pts (vlax-get c3ddoc 'Points)
	  cnt (vlax-get pts 'Count)
	  ctr 0)
	  
	  (while (&amp;lt; ctr cnt)
		(setq pt (vlax-invoke pts 'Item ctr)
			  pte (vlax-vla-object-&amp;gt;ename pt)
			  East (vlax-get pt 'Easting)
			  North (vlax-get pt 'Northing)
			  Elev (vlax-get pt 'Elevation)
			  RawDs (vlax-get pt 'RawDescription)
			  Num (vlax-get pt 'Number)
			  )
			  
			  (if (islabeldragged pte)
					(progn
						(setq LblLoc (pointlabellocation pte)
							  lblX (car lblloc)
							  lblY (cadr lblloc)
							  lblZ (caddr lblloc)
							  )
					(setq Dragged 1)
					)
					(setq Dragged 0)
					)
					(if (= dragged 1)
						(write-line (strcat (rtos num 2 0) "," (rtos east 2 4) "," (rtos north 2 4) "," (rtos Elev 2 3) "," RawDs "," (itoa dragged) "," (rtos lblx 2 4) ","
											(rtos lbly 2 4) "," (rtos lblz 2 4))
									fl)
						(write-line (strcat (rtos num 2 0) "," (rtos east 2 4) "," (rtos north 2 4) "," 
											(rtos Elev 2 3) "," RawDs "," (itoa dragged))
									fl)
					)
			
			(setq ctr (1+ ctr))
			)
			(close fl)
			(princ)
			)


(defun filenamegetter ( / pref)
  (setq pref (getvar "DWGPREFIX")
	dwgnm (substr (getvar "dwgname") 1 (- (strlen (getvar "dwgname")) 4))
	)
  (setq dwgnm (strcat pref dwgnm))
  )




;thanks to Jeff Mishler for the following code.  
(defun getAecAppNumber (/ );c3dnumber c3dproduct c3drelease)
  (setq	C3Dproduct (strcat "HKEY_LOCAL_MACHINE\\"
			   (if vlax-user-product-key
			     (vlax-user-product-key)
			     (vlax-product-key)
			   )
		   )
	C3Drelease (vl-registry-read C3Dproduct "Release")
	C3Dnumber  (substr
		     C3Drelease
		     1
		     (vl-string-search
		       "."
		       C3Drelease
		       (+ (vl-string-search "." C3Drelease) 1)
		     )
		   )
  )
)

(defun getdoc ( / )

  (setq appno (getaecappnumber))

  (setq	acadapp	(vlax-get-acad-object)
	c3dapp	(vla-getinterfaceobject acadapp (strcat "AeccXUiLand.AeccApplication." appno))
	C3Ddoc	(vla-get-activedocument C3Dapp)
  )

)					;end function&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 31 Jul 2020 02:21:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/civil-3d-customization-forum/how-to-see-if-a-point-label-has-been-moved-to-dragged-state/m-p/9665579#M8090</guid>
      <dc:creator>tcorey</dc:creator>
      <dc:date>2020-07-31T02:21:37Z</dc:date>
    </item>
  </channel>
</rss>

