POST
|
From SDK help: Note that only the top-level datasets in the workspace are returned by these methods. In particular, if a workspace contains both stand-alone feature classes and additional feature classes that are part of a feature dataset, then calling the DatasetNames property on the workspace with a dataset type of esriDTFeatureClass will return only the standalone feature classes. In order to get the feature class names within a feature dataset, the application needs to get the FeatureClassNames property on the top-level feature dataset name returned by the workspace. IWorkspace.DatasetNames Property will list all matched types for the top level only. If your feature classes are inside featuredataset you should use IFeatureDatasetName.FeatureClassNames After you get your dataset. Thanks Ahmed El Sisi
... View more
03-16-2014
05:04 PM
|
0
|
0
|
1817
|
POST
|
Here are a couple options. C# / ArcObjects:
IWorkspaceFactory workspaceFactory = new WorkspaceFactory();
IWorkspace workspace = workspaceFactory.OpenFromFile("[Path to an SDE connection file goes here]", 0);
var namesEnum = workspace.DatasetNames[esriDatasetType.esriDTFeatureClass];
var tempName = namesEnum.Next();
while (tempName != null)
{
// Add string comparison logic here, e.g. tempName.Name.StartsWith("G")
Console.WriteLine(tempName.Name)
tempName = namesEnum.Next();
}
Dear Erin Brimhall, I am getting a problem: my SDE contains some feature classes, but after using the statement:
var namesEnum = workspace.DatasetNames[esriDatasetType.esriDTFeatureClass];
var tempName = namesEnum.Next(); // get value null
The value of tempName is Null, but it is ok if I use esriDatasetType.esriDTFeatureDataset. Do you know why ? Thanks and regards, Tai
... View more
03-13-2014
12:38 AM
|
0
|
0
|
1817
|
POST
|
Hi, I am finding a statement to show or list all names of feature classes in SDE. Do you know this ? Thanks and regards, Tai
... View more
03-02-2014
03:43 PM
|
0
|
5
|
4928
|
POST
|
Use IDataset.Delete. I would imagine you can't delete feature datasets unless they are empty though. Thanks Neil, I got the error: Layer in use SDE when trying to delete. Please see my code:
IDataset pdataset;
pdataset = (ESRI.ArcGIS.Geodatabase.IDataset)featureClass;
if (pdataset.CanDelete() && pdataset != null)
pdataset.Delete(); // Throw exception
Do you know how to fix this ? Thanks and regards, Tai
... View more
02-25-2014
03:21 PM
|
0
|
0
|
914
|
POST
|
Hi everyone, Are there anyone know the statements/methods to delete a SDE feature dataset and a SDE feature class from SDE database ? (using C# or VB) Thank you very much. Tai
... View more
02-25-2014
04:57 AM
|
0
|
4
|
5220
|
POST
|
Hi everyone, I am getting a problem when try to read features from the Dgn files using ArcObjects. After I delete some elements (polygons) in Dgn file. They still exist when reading the dgn file. Do you know how to ignore the deleted features ? Please see my code:
Type factoryType = Type.GetTypeFromProgID(
"esriDataSourcesFile.CadWorkspaceFactory");
System.Object obj = Activator.CreateInstance(factoryType);
factory = obj as IWorkspaceFactory;
IFeatureWorkspace ftrWorkSpace = (IFeatureWorkspace)factory.OpenFromFile(strWorkSpace, 0);
IFeatureDataset pFeatureDataset = ftrWorkSpace.OpenFeatureDataset(strFileName);
IFeatureClassContainer pFeatureClassContainer = (IFeatureClassContainer)pFeatureDataset;
IFeatureClass pCadPolygon;
pCadPolygon = pFeatureClassContainer.get_ClassByName("polygon");
IFeatureCursor pFeatureCursor = pCadPolygon.Search(null, false);
if (pFeatureCursor == null)
return false;
While (pFeature != null)
{
//.....
}
Thanks and regards, Tai
... View more
02-24-2014
07:21 PM
|
0
|
0
|
666
|
POST
|
Thank you, The original dgn file haven't set coordinate system yet. Then I set it (same with projection system of SDE) as your say. But, the area still not equal. So I am checking features again I attached the project file for your refecence Thanks and regards, Tai
... View more
02-19-2014
05:47 PM
|
0
|
0
|
850
|
POST
|
Thank you. I am reading features from CAD file (.dgn) then write to feature class in SDE. I haven't set the SpatialReference for the geometries of these features before checking the area. Could you tell me how to set it ? Plese see my codes:
Type factoryType = Type.GetTypeFromProgID(
"esriDataSourcesFile.CadWorkspaceFactory");
System.Object obj = Activator.CreateInstance(factoryType);
factory = obj as IWorkspaceFactory;
IFeatureWorkspace ftrWorkSpace = (IFeatureWorkspace)factory.OpenFromFile(strWorkSpace, 0);
IFeatureDataset pFeatureDataset = ftrWorkSpace.OpenFeatureDataset(strFileName);
IFeatureClassContainer pFeatureClassContainer = (IFeatureClassContainer)pFeatureDataset;
IFeatureClass pCadPolygon;
IFeatureCursor pFeatureCursor = pCadPolygon.Search(pQueryFilter, false);
if (pFeatureCursor == null)
return false;
IFeature pFeature = pFeatureCursor.NextFeature();
while (pFeature != null)
{
......
}
Thanks and regards, Tai
... View more
02-19-2014
12:10 AM
|
0
|
0
|
850
|
POST
|
Thanks Sachin, Yes, it is the correct feature (polygon). But it contains many other features (polygons). So, I subtracted it the areas of sub features, but the final result doesn't equal the value: Shape.Area. How can I get the area of that feature (not include area of sub features) ? Please see my image (the current feature is green) [ATTACH=CONFIG]31541[/ATTACH] Thanks and regards, Tai
... View more
02-17-2014
09:32 PM
|
0
|
0
|
850
|
POST
|
Hi everyone, I used this statement to get the area value of polygon feature:
while (pFeature != null)
{
IGeometry shapeCopy = pFeature.ShapeCopy;
IArea area = pFeature.Shape as IArea;
double value = area.Area; // Result is: 110102.807...
// ....
pFeature = pFeatureCursor.NextFeature();
}
But when showing the identify: The Shape.Area is: 20737.12 (not equal 110102.807). Please see the image: [ATTACH=CONFIG]31505[/ATTACH] Do you know what's wrong with it ? Thanks and regards, Tai
... View more
02-17-2014
12:04 AM
|
0
|
11
|
2722
|
POST
|
Never use New to create an instance of a singleton object like a workspace factory. Always use the Activator class. Also, is this a standalone application? If so, are you binding to a product then checking out a license before running this code? Thanks Neil, I tried to use Activator, but still not successful.
Type factoryType = Type.GetTypeFromProgID(
"esriDataSourcesFile.CadWorkspaceFactory");
System.Object obj = Activator.CreateInstance(factoryType);
IWorkspaceFactory factory = obj as IWorkspaceFactory;
IFeatureWorkspace workspace = (IFeatureWorkspace)factory.OpenFromFile(dgnFilePath, 0);
Can I use dgn file path in the OpenFromFile method ? Thanks and regards, Tai
... View more
01-23-2014
05:34 PM
|
1
|
1
|
742
|
POST
|
Hi everyone, I am trying to install ArcSDE CAD Client tool for using with Microstation. When I try to add the ArcSDE CAD Client path to MicroStation. I can't find the scclient.ma file in the scclient folder and other folder. Another thing: I can't see the "cadclient" when chosing Interface, please see the attached file. [ATTACH=CONFIG]30748[/ATTACH] May you help me ? Thanks and regards, Tai
... View more
01-22-2014
10:35 PM
|
0
|
1
|
550
|
POST
|
Hi everyone, I am trying open and read Dgn file. But, I got the error "Error HRESULT E_FAIL has been returned from a call to a COM component ?" when using below codes:
IWorkspaceFactory factory = new CadWorkspaceFactoryClass ();
IWorkspace workspace = factory.OpenFromFile(fileName, 0); // Throw exception
May you help me fix this ? Thanks and regards, Tai
... View more
01-22-2014
08:52 PM
|
0
|
0
|
525
|
POST
|
Hi everyone, I am trying open and read Dgn file. But, I got the error when using below codes:
IWorkspaceFactory factory = new CadWorkspaceFactoryClass ();
IWorkspace workspace = factory.OpenFromFile(fileName, 0); // Throw exception
Do you know why ? I attached the dgn file. Thanks and regards, Tai
... View more
01-22-2014
04:57 PM
|
0
|
4
|
1886
|
Title | Kudos | Posted |
---|---|---|
1 | 01-23-2014 05:34 PM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|