Jump to content

Recommended Posts

Posted

Hi guys!

First of all, congrats for what you do here, it’s amazing to help others and keep them close to this amazing software - AutoCAD.

So, my kind request is as it follows:

I have the Click2XLS.vlx, the one that exports coordinates to Excel. And before everytime i use this .vlx, i have to change the UCS because i need coordinates from certain areas of a drawing from certain basepoints. My question is, can anyone please share a little assistance in slightly updating this .vlx and include the part where i move the UCS? 🤔 it is very time waisting and furthermore whenever i exit the command i have to click next cell in the Excel worksheet everytime, otherwise it will overwrite the existing coordinates; so being only one command, will be very helpfull.

 

Thanks in advance!🙏

Click2XLS.vlx

Posted

A *.vlx file is a compiled executable, and cannot be updated unless you have the associated *.lsp file(s) used to compile it.

Posted

I know, but i thought you guys knew another way.

Then, can this issue be solved with another .lsp?🤔

Posted

Write a defun that changes your UCS then after that add (c: click2xls) hopefully that is what you type in to run. Need the answer to the two questions what method your using to set UCS and click2xls command call.

 

(defun c:setucs (....
..........

..........

(c:click2xls)
)

 

Posted

Thanks for the reply.

 

So this is what i’m doing now, step by step:

1. Update the UCS location (UCS comand)

2. Use Click2XLS comand

3. Exit Click2XLS

4. Allover again (and have to do this lots of time a day)

So, the idea is to somehow join the UCS comand and the Click2XLS comand (exactly in this order). There is the “Multiple” command, but that is repeating only one task in a row, as far as i know.

 

Meanwhile, regarding the problem with the Excel focus cell when you use this routine several times in a row with an Exit between, i talked to the guy who created it and he updated it in order to ease the user’s experience (credits to http://www.cadstudio.cz)

 

Posted (edited)

I can save it into a CSV file and not xlsx. I don't basically know a thing about vlx or how it's used, but as far as LISP, this is the best I can offer:

 

(defun c:test ( / *error* fl i op org pt rtn sep x z zin)
    (defun *error* (msg)
	(if zin (setvar 'dimzin zin))
	(if op (close op))
	(if (not (wcmatch (strcase msg T) "*break*,*cancel*,*exit*"))
	    (princ (strcat "Error: " msg))
	    )
	)
    (while
	(and
	    (setq org (getpoint "\nSpecify origin <end>: "))
	    (setq pt (getpoint org "\nSpecify desired point <end>: "))
	    )
	(setq rtn (cons (mapcar '- pt org) rtn))
	)
    (if
	(and
	    (setq rtn (reverse rtn))
	    (setq fl (getfiled "Select output file" "" "csv" 1))
	    )
	(progn
	    (setq sep (cond ((vl-registry-read "HKEY_CURRENT_USER\\Control Panel\\International" "sList")) (","))
		  i 0
		  op (open fl "w")
		  zin (getvar 'dimzin)
		  )
	    (setvar 'dimzin 8)
	    (foreach y
		     (cons
			 (JH:lst->str '("Point ID" "X" "Y" "Z") sep)
			 (mapcar
			     '(lambda (z)
				  (JH:lst->str
				      (mapcar
					  '(lambda (x)
					       (rtos x 2 4)
					       )
					  (cons (setq i (1+ i)) z)
					  )
				      sep
				      )
				  )
			     rtn
			     )
			 )
		(write-line y op)
		)
	    (close op)
	    (setvar 'dimzin zin)
	    (alert "\nCSV successfully created.")
	    (startapp "explorer" fl)
	    )
	)
    )

;; JH:lst->str --> Jonathan Handojo
;; Concatenates a list of string into one string with a specified delimeter
;; lst - list of strings
;; del - delimiter string

(defun JH:lst->str (lst del)
    (apply 'strcat (append (list (car lst)) (mapcar '(lambda (x) (strcat del x)) (cdr lst))))
    )

 

Hopefully it's of some use though. Otherwise forgive me. Just trying to offer some assistance.

Edited by Jonathan Handojo
  • Like 1
Posted (edited)

Thanks Jonathan! That is tremendous! Origin -> coordinates -> export, exactly what i wanted!

Only improvement i would say is to export this coordinates in the already opened Excel/csv worksheet based on the excel focus cell  (and only if there isn't any open worksheet, to create a new one), instead of creating a new file everytime.

Nevertheless, it's great and thanks for the help!

Edited by Nick24
Posted (edited)

You may not have understood what I was suggesting you can run multiple lisp commands in a sequence.

(runlisp1)

(runlisp2)

(runlisp3)

So you can make a defun that sets the ucs then runs the click2xls and will repeat something like this.

(defun c:click2 ()
(if (not click2xls)(load "click2xls"))
(while (setq pt1 (getpoint "\nPick 1st point for ucs Enter to exit"))
.... do set UCS using pt1 and other points
(c:click2xls)
)
(princ)
)

 

Edited by BIGAL

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...