<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Verdana;
panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
span.E-MailFormatvorlage17
{mso-style-type:personal-compose;
font-family:"Verdana",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=DE link="#0563C1" vlink="#954F72"><div class=WordSection1><p class=MsoNormal><span style='font-family:"Verdana",sans-serif'>Hello,<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Verdana",sans-serif'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-family:"Verdana",sans-serif'>I‘ new to this list and this is my first question. I try to develop a script that is able to import CAD files (MicroStation DGN) into a grass mapset. First, I tried the command v.in.ogr in the menu system and everything works fine. The result is exactly as desired. Then, I tried to write a Python script that is able to do exactly the same but without starting GRASS. <o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Verdana",sans-serif'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-family:"Verdana",sans-serif'>The command line provided by the menu input (in QGIS‘ Grass toolbox) reads:<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Verdana",sans-serif'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-family:"Courier New"'>v.in.ogr dsn=D:/my.dgn output=gr03 type=boundary,centroid snap=0.01 min_area=1 "where="Level" = 1" –o<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Verdana",sans-serif'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-family:"Verdana",sans-serif'>Searching the internet for sample scripts, I found some of those and modified my command string according to the samples:<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Verdana",sans-serif'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-family:"Courier New"'>import grass.script as grass<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Courier New"'>import grass.script.setup as gsetup<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Courier New"'>gsetup.init(gisbase,gisdbase,location,mapset)<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Courier New"'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-family:"Courier New"'>input_dgn = "D:\\my.dgn"<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Courier New"'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-family:"Courier New"'>grass.run_command("v.in.ogr",<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Courier New"'> dsn = input_dgn,<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Courier New"'> output = 'gr03',<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Courier New"'> type = 'boundary,centroid',<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Courier New"'> snap = 0.01,<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Courier New"'> min_area = 1,<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Courier New"'> where = """"Level" = 1""")<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Verdana",sans-serif'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-family:"Verdana",sans-serif'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-family:"Verdana",sans-serif'>Unfortunately, this does not work. I get an error crash message telling me that v.in.ogr does not work any more. I tried many different options, including other use of quotes or leaving some args off. Nothing helped. Maybe there is a keyword conflict or an issue with the order of the args? The „where“ part is very important since it helps me split the data like i need to. I use Grass 6.4.4<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Verdana",sans-serif'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-family:"Verdana",sans-serif'>Thanks a lot for help an ideas,<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Verdana",sans-serif'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-family:"Verdana",sans-serif;mso-fareast-language:DE'>Regards, Uwe<o:p></o:p></span></p></div></body></html>