
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
(auto/visual)-LISP noob here 🙂
Could somebody take a look at the code below and point me in the right direction, please?
Any help would be much appreciated, I would be very grateful 🙂
I'm trying to create a (auto/visual)-LISP that does the following:
- Make a selectionset of all P-lines in modelspace in layers X_050, X_CU50 and X_TU050
- Retrieve the XY-coordinates of these polylines
- Create a notepad-file and paste these coordinates in the following manner:
"start-text"+"start-pline" + "XY-coordinates pline1" + "end-pline" + "start-pline" + "XY-coordinates pline2" + "end-pline" + ... + "end-text"
(the "start-text", "start-pline", "end-pline" and "end-text" will be replaced by strings)
-Save this notepad-file as a .gml, in a folder specified by 'path_leg'
FYI:
Should be able to handle between 1 and 100 plines.
Exporting as a GML via MAPEXPORT doesnt seem to be an option, because the strings in need to use as "start-text","start-pline"... are to specific.
Tried using Google for hours to come up with a solution. I found much useful info, but haven't been able to combine it in my specific case.
This is what I have so far:
(defun c:test1 () (setq n1 (- (strlen (getvar "dwgprefix")) 4));;look for the current DWG-folder and remove the last 4 characters (setq path_leg (strcat (substr (getvar "dwgprefix") 1 n1) "GIP\\"));;change the above path and add a "GIP"-folder, assign to 'path_leg' (vl-mkdir path_leg);;create the GIP-folder (setq fn1 (vl-filename-base (getvar "dwgname")));; assign the current DWG-name to 'fn1' (setq gmlfile (open (getfiled fn1 path_leg "gml" 1) "w"));;create textfile with name stored in 'fn1' in the new GIP-folder with extention .gml (write-line "start-text" gmlfile);; write "start-text" at the start of the GML-file (setq ss1 (ssget x (0 . "*LINE")(8 . "X_050")(8 . "X_TU050")(8 . "X_CU050")(67 . 0)));;make a selectionset of the plines in modelspace in the given layers
THANK YOU TO ANYONE WHO REPLIES 🙂
Solved! Go to Solution.