CAD Forum - Database of tips, tricks and utilities for AutoCAD, Inventor and other Autodesk products [www.cadforum.cz]
CZ | EN | DE
Login or
registration
  Visitors: 5444
RSS channel - CAD tips RSS tips
RSS discussions

Discussion Discussion forum

 

HelpCAD discussion

 
CAD Forum - Homepage CAD discussion forum - ask any CAD-related questions here, share your CAD knowledge on AutoCAD, Inventor, Revit and other Autodesk software with your peers from all over the world. To start a new topic, choose an appropriate forum.

Please abide by the rules of this forum.

How to post questions: register or login, go to the specific forum and click the NEW TOPIC button.
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Topic ClosedExtracting specific text from AutoCAD dwg to txt f

 Post Reply Post Reply
Author
aglasier View Drop Down
Newbie
Newbie


Joined: 28.May.2018
Location: Canada
Using: AutoCAD 2016
Status: Offline
Points: 3
Direct Link To This Post Topic: Extracting specific text from AutoCAD dwg to txt f
    Posted: 28.May.2018 at 21:06
I am attempting to extract data from drawings given to me that do not have attributes assigned to certain text blocks. I do know the data I want will contain either "MARK", "ETCH", or "STAMP".

I have tried entering 
(ssget "_X" '((0 . "TEXT,MTEXT")(1 . "ETCH*,MARK*,STAMP*"))) 
at the "select objects" prompt which will select the text blocks I am looking for but when I run it with my lisp routine I get an error: 
"; error: bad argument type: stringp nil"

I am however able to pick up the text I need with DATAEXTRACTION but I'm not sure if there's a way filter out text with value I do not care about.

I am still new to lisp and data extraction so bare with me lol

Below is my current lisp routine which works for data that has attributes, what I did was replace the current ssget command with the one i mentioned above to get that error.

(defun c:att-out (/ dn)
 (load "attout")
 (setq dn (getvar "dwgname"))
 (setq fna (strcat "C:/Users/Allan/Desktop/LISP/dump/" dn ".txt"))
 (setq ss (ssget '((0 . "INSERT") (66 . 1))))
 (bns_attout fna ss)
)

I have also thought of just using DATAEXTRACTION to grab everything and sorting it out in excel but it would be easier if I could avoid that. Any help to put me on the right track would be greatly appreciated.

I apologize if i did not include everything you need here, just let me know if you need more information and I will be happy to supply it.

Back to Top
Vladimir Michl View Drop Down
Moderator Group
Moderator Group

Arkance Systems CZ

Joined: 26.Jul.2007
Location: Czech Republic
Using: Autodesk software
Status: Offline
Points: 2018
Direct Link To This Post Posted: 28.May.2018 at 21:35
The (ssget) function you are using is correct. Only the "Select objects:" prompt should come from a standard editing command, not from an add-on application. LISP calls cannot be nested.
Vladimir Michl (moderator)
Arkance Systems - arkance-systems.cz - Autodesk reseller
Back to Top
aglasier View Drop Down
Newbie
Newbie


Joined: 28.May.2018
Location: Canada
Using: AutoCAD 2016
Status: Offline
Points: 3
Direct Link To This Post Posted: 28.May.2018 at 21:51
Thank you for the reply Valdimir, 

So I'm on the right track to selecting the objects I need, how would I go about writing a lisp routine to extract that specific data? Or is there another route that would be better to take with this?

Some background might be useful, the reason I'm doing this is to verify all of the data on the drawings are correct. I can get most of it with the Data extraction tool but as far as i'm aware you cannot specify which text to grab like I can with the ssget function. Once this is working it will be used on many different drawings at once so i'm trying to write something to automate that process a bit.
Back to Top

Related CAD tips:


 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down



This page was generated in 0,391 seconds.