Jump to content

Recommended Posts

Posted (edited)

Hi friends,

I have a problem with the extraction attributes of the block.

In the past I had write a routine for export and it was ok in action.

Now I have autcad 2021 and this routine non function.

 

This is part of code

(defun c;test1 ()

(setq path (getvar "dwgprefix"))

(setq name1 (getvar "dwgname")

(seq path_all (strcat path name1))



;;(setq p1 (list -46763 29023 0.000))

;;(setq p2 (list -3370 -34457 0.000))



(command 

"_-dataextraction"

"_o"

(ssget "_w" p1 p2 '((2 . "tag50")) )

""

""

""

"c:/mydir/template-01.dxe"

"csv"

path_all

);com

 

The file is create, but is empty....

if test on command line it's ok and the csv is full

 

Help me...

thanks

 

Edited by SLW210
Added Code Tags!!
Posted

Please use Code Tags for your code in the future. (<> in the editor toolbar)

 

For starters the defun uses  ; instead of  :

 

(defun c;test1 ()

 

(defun c:test1 ()

 

Do you have an example .dwg?

 

Posted

 

19 minutes ago, Frank G said:

Hi friends,

I have a problem with the extraction attributes of the block.

In the past I had write a routine for export and it was ok in action.

Now I have autcad 2021 and this routine non function.

 

This is part of code

(defun c;test1 ()

(setq path (getvar "dwgprefix"))

(setq name1 (getvar "dwgname")

(seq path_all (strcat path name1))



;;(setq p1 (list -46763 29023 0.000))

;;(setq p2 (list -3370 -34457 0.000))



(command 

"_-dataextraction"

"_o"

(ssget "_w" p1 p2 '((2 . "tag50")) )

""

""

""

"c:/mydir/template-01.dxe"

"csv"

path_all

);com

 

The file is create, but is empty....

if test on command line it's ok and the csv is full

 

Help me...

thanks

 

 

Hi,

It’s likely due to differences in the parameters required by that command in your previous version of AutoCAD compared to those required in the 2021 version.

You’ll have no choice but to investigate it.
Type the following in the command line:

(command "_-dataextraction")

Press ENTER and observe what it asks for, so you can compare it with what your code is expecting.

Posted

If you google you will find lots of examples of using a lisp to do what you want, "write attributes to CSV autolisp", you can take advantage of say picking a block to get its name, in a more advanced version using a dcl can choose which attributes to write to say a CSV. A more global answer. For me write direct to Excel no csv. You could do a pick multiple blocks and do the procedure.

 

Post a dwg and a dxe file so can see what your trying to export to a csv.

 

Welcome aboard.

Posted

I use Bricscad and it does not support the dxe provided. But your lisp has problems this is closer, but not tested in Acad.

 

defun c:dex_01 (/ path01 name01 path_all p1 p2 )
  (setvar "cmdecho" 0)
 
  (setq path01 (getvar "DWGPREFIX"))
  (setq name01 (getvar "DWGNAME"))
  (setq path_all (strcat path01 name01))

(SETQ P1 (getpoint "\nPick 1st point "))
(SETQ P2 (getcorner p1 "\nPick other point ")
  
(command
	    	  "_-dataextraction"
		  "_o"
		  (ssget "_W" p1 p2 '((0 . "INSERT")(2 . "Info3")))
		  ""
		  ""
		  ""
		  "C:/my_dir/mod-estrazione-03.dxe"
		  "csv"
		  path_all
	)

    );def

 

Posted

ok, i making a test

Posted
29 minutes ago, Frank G said:

ok, i making a test

(command
"_-dataextraction"
":c/my_dir/mod-estrazione-03.dxe"
)

 

Posted

with only this command it's solved.

Into the dxe model there is all information...

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...