bfordmn Posted November 13, 2012 Posted November 13, 2012 There seems to be plenty of topics on extracting info from an AECC_POINT, but nothing that I could find on setting an AECC_POINT from within a LISP routine. I have not written much lisp since the early 2000's, but we now need a routine that will run in LDD 2004 that will place an AECC_POINT at the center of collection of about 500 small circles in a DWG. I will have no problem creating a selection set of the circles and looping through the SS to get the center points, but I cannot figure out how to execute the "place point manual" from withing lisp. The command associated with the icon is: ^C^C^C^P(cr_mnl)(zz_sdsk '(cg:setpts:manual));LDD I just need to be able to execute a "command" from within lisp that will fire off the place point manual command. I will then feed it centerpoint coordinates from each of the circles in the SS. Any help would be appreciated. Ben Quote
BlackBox Posted November 13, 2012 Posted November 13, 2012 Welcome to CADTutor. Unfortunately, Land Desktop uses an external database, and the internal commands are not able to be PAUSEd for user input as one would for generic AutoCAD Commands. The only way you may be able to do this, is to interface with the External, ActiveX COM, AeccApplication Object. Consider these help files located in your ..\\Help\ directory: (defun c:LAG () (c:LandAutoGuide)) (defun c:LandAutoGuide (/ file path) (if (setq path (findfile (setq file "landauto-guide.chm"))) (startapp "explorer" path) (prompt (strcat "\n** \"" file "\" cannot be found ** ")) ) (princ) ) (defun c:LAR () (c:LandAutoReference)) (defun c:LandAutoReference (/ file path) (if (setq path (findfile (setq file "landauto-reference.chm"))) (startapp "explorer" path) (prompt (strcat "\n** \"" file "\" cannot be found ** ")) ) (princ) ) Quote
bfordmn Posted November 14, 2012 Author Posted November 14, 2012 Thank you for your response. I had a feeling that placing points within LISP would be difficult. Given my rustiness and lack of time, I probably will not pursue this, considerably more complicated approach. I have decided to simplify the problem. Since the LDD command "Create Points Automatic" will set points at the ends of any number of interconnected lines, all I have to do is loop thru each of the circle elements and create one long interconnnected line string. Then, outside of LISP, I can simply run the "create points automatic" command, select the long line segment that was created by LISP, and points will be placed at each circle center. The solution is not as elegant, but much, much simpler to write and almost as quick to execute. Thanks again. Quote
SLW210 Posted November 14, 2012 Posted November 14, 2012 Please read the CODE POSTING GUIDELINES and edit your post to include code tags. Quote
BlackBox Posted November 14, 2012 Posted November 14, 2012 Given that you're using 'dumb' circles (read no point number, attribute, or object data, etc.), why not instead simply export the coordinates for each circle to an ASCII Text file (PNEZ?), and then import as points? Methinks this would be far more efficient than attempting to perform a Land Desktop command (infamously slow) upon each circle. (vl-load-com) (defun c:CTOA () (c:CircleToAscii)) (defun c:CircleToAscii (/ *error* ss n i path acApp acDoc oShell file pt) (princ "\rCIRCLETOASCII ") (defun *error* (msg) (if oShell (vlax-release-object oShell) ) (if file (close file) ) (cond ((not msg)) ; Normal exit ((member msg '("Function cancelled" "quit / exit abort"))) ; <esc> or (quit) ((princ (strcat "\n** Error: " msg " ** "))) ; Fatal error, display it ) (princ) ) (if (and (setq ss (ssget "_:L" '((0 . "CIRCLE")))) (setq n (sslength ss)) (setq i 0) (setq path (strcat (vl-filename-directory (vl-filename-mktemp)) "\\" (vl-filename-base (getvar 'dwgname)) "_" (menucmd "M=$(edtime,$(getvar,date),YYYY-MO-DD)") "_PNEZ" ".txt" ) ) (setq acApp (vlax-get-acad-object)) (setq acDoc (vla-get-activedocument acApp)) (princ "\nWorking, please wait...") (princ) (setq oShell (vla-getinterfaceobject acApp "Shell.Application") ) ) (progn (if (findfile path) (vl-file-delete path) ) (setq file (open path "w")) (vlax-for x (setq ss (vla-get-activeselectionset acDoc)) (write-line (strcat (itoa (setq i (1+ i))) "," (rtos (cadr (setq pt (vlax-get x 'center)))) "," (rtos (car pt)) "," (rtos (last pt)) ) file ) ) (setq file (close file)) (vla-delete ss) (prompt (strcat "\n** " (itoa n) " circles processed ** ")) (vlax-invoke oShell 'open path) (*error* nil) ) (cond (acDoc (*error* "Unable to create \"Shell.Application Object\"") ) (n (*error* "Unable to create temporary file")) ((*error* "No circles selected")) ) ) ) Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.