Lisp to Unlock Survey Database Points

Lisp to Unlock Survey Database Points

BennnttPLS
Participant Participant
631 Views
3 Replies
Message 1 of 4

Lisp to Unlock Survey Database Points

BennnttPLS
Participant
Participant

I am creating a Lisp routine to handle the multiple steps our survey team has to perform every time we import survey data.  (copy linework to a 3D breaklines layer, convert the orignal linework to 2D so we can actually draft with it etc.) I've got it all working, excpet for unlocking the points. The current manual workflow is:

Toolspace>Survey>Survey DataBases>"TodaysDownload"> rightclick Points> Unlock in Drawing

I would like to have a bit of Lisp code to do this.  Thanks in advance!

Note: This is not the "Locked Point" status that shows up in Properties, it is the "Survey Point" status shown under the "Data" heading in the Properties Dialog box

BennnttPLS_0-1724092035552.png

 

0 Likes
Accepted solutions (1)
632 Views
3 Replies
Replies (3)
Message 2 of 4

CodeDing
Advisor
Advisor
Accepted solution

@BennnttPLS ,

 

I honestly don't know if there is a way to Properly do what you're asking for via Lisp, unless you create like a .NET solution to assist. So here is a way that I know WILL work...

...Even though it seems a bit sketchy because it Deletes points then un-deletes them, my testing could not get it to break (All of my points always remained in the dwg, even when I tried to escape the command).

 

My company does not currently require this workflow, but if it did, and I could not implement a .NET solution, I would feel comfortable releasing this command to my group, knowing that I have covered every base I could in preventing possible data deletion.

 

(defun c:TEST ( / *error* pt)
  ((lambda ( / C3D)
    (setq C3D (strcat "HKEY_LOCAL_MACHINE\\"
                      (if vlax-user-product-key
                        (vlax-user-product-key)
                        (vlax-product-key)
                      );if
              );strcat
          C3D (vl-registry-read C3D "Release")
          C3D (substr
                C3D
                1
                (vl-string-search "." C3D (+ (vl-string-search "." C3D) 1))
              );substr
          *C3D* (vla-getinterfaceobject
                  (vlax-get-acad-object)
                  (strcat "AeccXUiLand.AeccApplication." C3D)
                );vla-getinterfaceobject
          *docC3D* (vla-get-activedocument *C3D*)
    );setq
  ));eval/lambda
  (defun *error* (msg)
    (vla-EndUndoMark *docC3D*)
    (command-s "_.UNDO" "1")
    (if (not (member msg '("Function cancelled" "quit / exit abort")))
      (princ (strcat "\nError: " msg))
    );if
    (princ)
  );defun *error*
  (vla-StartUndoMark *docC3D*)
  (vlax-for pt (vlax-get *docC3D* 'Points)
    (if (not (zerop (vlax-get pt 'SurveyPoint)))
      (vla-delete pt)
    );if
  );vlax-for
  (vla-EndUndoMark *docC3D*)
  (command "_.UNDO" "1")
  (prompt "\nComplete.")
  (princ)
);defun

 

Best,

~DD

0 Likes
Message 3 of 4

CodeDing
Advisor
Advisor

@BennnttPLS ,

 

You might also be interested in my "SF2" command, which converts Survey Figures to either 3D Feature Lines, or 2D Polylines. I posted here recently:

https://forums.autodesk.com/t5/civil-3d-forum/database-processing-feature-lines-instead-of-survey-fi... 

 

Best,

~DD

0 Likes
Message 4 of 4

BennnttPLS
Participant
Participant

That worked a treat!  THANK YOU!

0 Likes