Sambuddy Posted February 14 Posted February 14 (edited) Not quite sure how to tackle this, because my options on the -mapimport is very limitted and did not completely understand ADE_ function library. When I use the dialouge box of mapimport, I do get options of "creating object data" in addition to "creating points as blocks" with the option of "getting attribute values from field". So I simply create a block and define attributes with the TAG to match the the "Attribute Table" from QGIS and everything works as it should - that is I now have blocks that show the values for each block because I selected "Get attribute values from field" on Mapimport dialouge box. Can it be possible to have a routine that automate this process to 0) select a folder that contains multiple shape files and not selected one by one 1) import the map (lines and points) 2) lines and maps to be imported with their respected Object data 3) dynamic blocks be inserted that contain attributes to show the OD values at each imported points 4) visibilities of the blocks change with values/ attributes (example: if value is Hydro then visibility A and if Telecom then visibility B)? so here on this code, I am selecting a folder and then reading the content (shape files), but then I cannot go further because -mapimport did not give me all the options needed. also Block_1 and Block_2 are just examples of a block/ currently with no visibility for the conditions stated above. I do not work with Map3D all that often so help is appreciated! ( (lambda ( / path);lstall lstseluser (defun BrowseForFolder ( / sh folder folderobject result) (vl-load-com) (setq sh (vla-getInterfaceObject (vlax-get-acad-object) "Shell.Application")) (setq folder (vlax-invoke-method sh 'BrowseForFolder 0 "" 0)) (vlax-release-object sh) (if folder (progn (setq folderobject (vlax-get-property folder 'Self)) (setq result (vlax-get-property FolderObject 'Path)) (vlax-release-object folder) (vlax-release-object FolderObject) result ) ) ) (if (null (setq path (BrowseForFolder))) ;; just in case you didnt specify a path nil (setq lstall (vl-directory-files path "*.shp" 1))) ;---------------------------------------- ;; msg - [str] Dialog label ;; lst - [lst] List of strings to display ;; bit - [int] 1=allow multiple; 2=return indexes ;; Returns: [lst] List of selected items/indexes, else nil (defun LM:listbox ( msg lst bit / dch des tmp rtn ) (cond ( (not (and (setq tmp (vl-filename-mktemp nil nil ".dcl")) (setq des (open tmp "w")) (write-line (strcat "listbox:dialog{label=\"" msg "\";spacer;:list_box{key=\"list\";multiple_select=" (if (= 1 (logand 1 bit)) "true" "false") ";width=50;height=15;}spacer;ok_cancel;}" ) des ) (not (close des)) (< 0 (setq dch (load_dialog tmp))) (new_dialog "listbox" dch) ) ) (prompt "\nError Loading List Box Dialog.") ) ( t (start_list "list") (foreach itm lst (add_list itm)) (end_list) (setq rtn (set_tile "list" "0")) (action_tile "list" "(setq rtn $value)") (setq rtn (if (= 1 (start_dialog)) (if (= 2 (logand 2 bit)) (read (strcat "(" rtn ")")) (mapcar '(lambda ( x ) (nth x lst)) (read (strcat "(" rtn ")"))) ) ) ) ) ) (if (< 0 dch) (unload_dialog dch) ) (if (and tmp (setq tmp (findfile tmp))) (vl-file-delete tmp) ) rtn ) (if (not (= lstall nil)) (setq lstseluser (LM:listbox "Select one or more shape files (Ctrl or Shift):" lstall 1)) ) ;---------------------------------------- (if (not (= lstall nil)) (progn (alert (vl-prin1-to-string lstseluser)) ) ) ) ) Edited March 28 by Sambuddy 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.