export from cad to shapefile

2775
8
04-01-2014 04:30 AM
Highlighted
New Contributor
i have use arcgis10.1,arcobjects.net.

i  did following code

            ESRI.ArcGIS.Geoprocessor.Geoprocessor gp = new ESRI.ArcGIS.Geoprocessor.Geoprocessor();
            gp.OverwriteOutput = true;

            ESRI.ArcGIS.ConversionTools.FeatureClassToShapefile tool = new ESRI.ArcGIS.ConversionTools.FeatureClassToShapefile();

          
            tool.Input_Features = @"F:\test buffer of JAMNAGAR SHP FILES ex3\FOOTPATH.dwg";
            tool.Output_Folder = @"C:\Temp1";
            gp.Execute(tool, null);

but after execute this code i got error "Error HRESULT E_FAIL has been returned from a call to a COM component. "
if any one have any suggestion or any sample for this conversion or any link then send me please ..
Reply
0 Kudos
8 Replies
Highlighted
New Contributor
yes it work manually very well.
i am also storing path in different two string but that code also show me same error please .


            ESRI.ArcGIS.Geoprocessor.Geoprocessor gp = new ESRI.ArcGIS.Geoprocessor.Geoprocessor();
            gp.OverwriteOutput = true;

            ESRI.ArcGIS.ConversionTools.FeatureClassToShapefile tool = new ESRI.ArcGIS.ConversionTools.FeatureClassToShapefile();
            string fpath = @"C:\Temp1";
            string spath = @"F:\test buffer of JAMNAGAR SHP FILES ex3\FOOTPATH.dwg";
            tool.Output_Folder = spath;
            tool.Input_Features = fpath;
            gp.Execute(tool, null);

please give me some idea on this.
Reply
0 Kudos
Highlighted
Occasional Contributor III
yes it work manually very well.
i am also storing path in different two string but that code also show me same error please .


            ESRI.ArcGIS.Geoprocessor.Geoprocessor gp = new ESRI.ArcGIS.Geoprocessor.Geoprocessor();
            gp.OverwriteOutput = true;

            ESRI.ArcGIS.ConversionTools.FeatureClassToShapefile tool = new ESRI.ArcGIS.ConversionTools.FeatureClassToShapefile();
            string fpath = @"C:\Temp1";
            string spath = @"F:\test buffer of JAMNAGAR SHP FILES ex3\FOOTPATH.dwg";
            tool.Output_Folder = spath;
            tool.Input_Features = fpath;
            gp.Execute(tool, null);

please give me some idea on this.


The .DWG file "FOOTPATH.dwg" is a CAD Dataset, you should pass a featureclass which is a layer inside the .DWG file ex. (Point,Polyline,Polygon)
so the input format should be( ~\File.dwg\LayerName)
This should work for you

ESRI.ArcGIS.Geoprocessor.Geoprocessor gp = new ESRI.ArcGIS.Geoprocessor.Geoprocessor();
gp.OverwriteOutput = true;

ESRI.ArcGIS.ConversionTools.FeatureClassToShapefile tool = new ESRI.ArcGIS.ConversionTools.FeatureClassToShapefile();

//@"F:\test buffer of JAMNAGAR SHP FILES ex3\FOOTPATH.dwg\Point"
//@"F:\test buffer of JAMNAGAR SHP FILES ex3\FOOTPATH.dwg\Polyline"
//@"F:\test buffer of JAMNAGAR SHP FILES ex3\FOOTPATH.dwg\Polygon"
tool.Input_Features = @"F:\test buffer of JAMNAGAR SHP FILES ex3\FOOTPATH.dwg\Point";
tool.Output_Folder = @"C:\Temp1";
gp.Execute(tool, null);


Regards,
Highlighted
New Contributor
Hello ahmed sir,
thank for reply ,but after making changes like you suggest l got new error that is
"Attempting managed execution inside OS Loader lock. Do not attempt to run managed code inside a DllMain or image initialization
function since doing so can cause the application to hang."

if you have any suggestion on this please let me know....
Reply
0 Kudos
Highlighted
Occasional Contributor III
can you post the full exception data?
Reply
0 Kudos
Highlighted
New Contributor
i have attached image with this reply please check it out[ATTACH=CONFIG]32833[/ATTACH]
Reply
0 Kudos
Highlighted
Occasional Contributor III
i have attached image with this reply please check it out[ATTACH=CONFIG]32833[/ATTACH]

Try to uncheck "Enable unmanaged code debugging" checkbox from debug menu in project properties.
Highlighted
New Contributor
i did that already but i get another because of this i have attached image of that error please check it out and you have any solution then let me know or have you have any sample for this or sample code then please send me thank you [ATTACH=CONFIG]32916[/ATTACH]
Reply
0 Kudos
Highlighted
Occasional Contributor III
i did that already but i get another because of this i have attached image of that error please check it out and you have any solution then let me know or have you have any sample for this or sample code then please send me thank you [ATTACH=CONFIG]32916[/ATTACH]


Check System File Checker tool from Microsoft
http://support.microsoft.com/kb/929833
It's not Arcobject  error, also you can try to run your code on another machine.