TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: viva on October 30, 2006, 05:06:26 AM
-
hi everybody,
hi everybody,
iam working in Autodesk map. i had tried to import the shape files into autodesk map through lisp. but i cant . can anyone help me regarding this issue
i had used
(command "mapimport" "d:\line.shp") ----- its helpless
regards
vivek
-
How about ;
(command "mapimport" "d:\\line.shp")
or
(command "mapimport" "d:/line.shp")
-
hi kerry,
thanks for ur immediate reply. that command is not working
regards
viva
-
don't have map, so was just a guess ...
be patient, someone will come along ..
-
The mapimport command always comes up with a dialog to specify both the file name AND the file type (approx. 10 choices). Same results when command is preceded with a "-" or a ".". I don't know if there is a way around this or not with lisp or vba.
-
How about playing with the CMDDIA settings .. what happens if CMDDIA is 0 ??
-
cmddia and filedia settings set at "0" still yield the dialog box
At least using ivil 3D 2007 . . . I can check 2005 in a minute.
-
Setting filedia to "0" will call for the command line input. The first request is for the file type. The response for his requested file is SHAPE. then it requests a file path and name.
This is true for 2007 as well.
-
You need to specify the file type; in this case, SHAPE.
Give this a shot. I don't have a SHP file to test so I don't know if there are any other prompts after the file name.
(setvar "filedia" 0)
(command "-mapimport" "shape" "d:/line.shp")
(setvar "filedia" 1)
-
This is a routine I used to import a whole series of shape files into 2000i
Most of the routine is garbage for you but the section that does the import works. Same ideas as everyone else has given.
(defun c:runimp (/ n ntsnum ntsnumlist source_folder nts_sheet dwgid)
(setvar "cmddia" 0)
(setvar "filedia" 0)
(command "ucsicon" "OFF" "")
(setq ntsnumlist
(list "01" "02" "03" "04" "05" "06" "07" "08"
"09" "10" "11" "12" "13" "14" "15" "16"
)
)
(setq nts_sheet "64L")
(setq n 0)
(while (< n 16)
(setq ntsnum (nth n ntsnumlist))
(setq source_folder
(strcat "C:\\Drawings\\Topo83\\"
nts_sheet
"\\"
ntsnum
)
)
(command "MAPIMPORT" "SHAPE" source_folder "N" "P")
(setq n (1+ n))
(ade_projsetwscode "UTM83-13")
(ade_dsattach
(strcat "C:\\Drawings\\Topo\\" nts_sheet
"\\new_" nts_sheet ntsnum
".dwg"
)
)
(setq dwgid (ade_dwggetid
(strcat "C:\\Drawings\\Topo\\"
nts_sheet "\\new_"
nts_sheet ntsnum
".dwg"
)
)
)
(ade_dwgactivate dwgid)
(ade_qryclear)
(ade_qrysettype "draw")
(ade_qrydefine '("" "" "" "Location" ("all") ""))
(ade_qrydefine
'("AND"
""
""
"Property"
("layer" "=" "CORNER_COORD_TEXT,TopoText")
""
)
)
(ade_qrysetaltprop nil)
(ade_qryexecute)
(ade_qryclear)
(ade_dsdetach dwgid)
(command "ZOOM" "e" "")
(command "SAVEAS"
"2000"
(strcat "C:\\Drawings\\Topo83\\"
nts_sheet "\\"
nts_sheet ntsnum
".dwg"
)
)
; now clear everything out of the drawing
(setq ss1 (ssget "X"))
(command "ERASE" ss1 "")
(setq ss1 nil)
)
(setvar "cmddia" 1)
(setvar "filedia" 1)
(princ)
)
-
Thanks for ur valuable information. I had learned so many news commands from ur discussion. It helped me a lot.
Regards
viva