How to hide/unhide FDO features through vb.net c# or lisp code

How to hide/unhide FDO features through vb.net c# or lisp code

Anonymous
Not applicable
1,662 Views
15 Replies
Message 1 of 16

How to hide/unhide FDO features through vb.net c# or lisp code

Anonymous
Not applicable

Hi,

 

I want to hide/unhide only selected FDO features(oracle database) through programming .

 

Manually option is there inside the query filter but i want it automatic.

 

Any one can help me i am using auto cad 2015 map

 

Dim currentMap As Autodesk.Gis.Map.Platform.AcMapMap = Autodesk.Gis.Map.Platform.AcMapMap.GetCurrentMap()
' Dim layers As MgLayerCollection = currentMap.GetLayers()

Dim layers As MgLayerCollection = currentMap.GetLayers()
Dim layer As Autodesk.Gis.Map.Platform.AcMapLayer = layers.GetItem("CONDUIT")

Dim query As MgFeatureQueryOptions = New MgFeatureQueryOptions()
query.SetFilter("OBJECTID = 183075")

Dim featureReader As MgFeatureReader = layer.SelectFeatures(query)
Dim selectionSet As Autodesk.Gis.Map.Platform.AcMapSelection = New Autodesk.Gis.Map.Platform.AcMapSelection(currentMap)

selectionSet.AddFeatures(layer, featureReader, 0)

featureReader.Close()

 

If layer.Visible = True Then


layer.SetFeatureVisibility(selectionSet, True)


End If

 

but it is showing erro on this line 

 

layer.SetFeatureVisibility(selectionSet, True)

 

 

0 Likes
1,663 Views
15 Replies
Replies (15)
Message 2 of 16

Alfred.NESWADBA
Consultant
Consultant

Hi,

 

>> I want to hide/unhide only selected FDO features(oracle database) through programming .

Imho that does not work, you might check either the styles or the filter for layers to make the display of single entities invisible.

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
ISH-Solutions GmbH / Ingenieur Studio HOLLAUS
www.ish-solutions.at ... blog.ish-solutions.at ... LinkedIn ... CDay 2026
------------------------------------------------------------------------------------

(not an Autodesk consultant)
0 Likes
Message 3 of 16

Anonymous
Not applicable

How can i stylize through programming there are option to assign query to display as  a manually but i am not getting any option in programming.

 

please if you have code to stylize fdo feature by its query .

 

I can change through layerdefinitation xml but it is not suitable for one feature suppose some time i want to hide one feature and after 1 minute i want to hide one more other feature so it is time taken process to change layerdefination file.

0 Likes
Message 4 of 16

Anonymous
Not applicable

one more thing i dont have permit-ion to update in oracle database it is only for readable. 

0 Likes
Message 5 of 16

Anonymous
Not applicable

Ya its working i got the problem and resolved

 

thanksv

Spoiler
Smiley Very Happy
0 Likes
Message 6 of 16

Anonymous
Not applicable

I have another issue regarding fdo layer.

some times i got error in FDO layer and shows error message "feature can not be refresh" but layer symbol is ok in drawing and it's layer palates  shows yellow color error markup.

 

when i see the property of that layer "by selecting layer and right click" some option is not active now like "query to filter data" etc.

 

I do refresh but no changes

 

I do disconnect and reconnect the oracle data but no changes. 

 

I found only one solution that i i have to remove that layer from map and make a new query to attach that layer freshly but it is not correct solution i want to correct in the same layer without attaching fresh layer.

0 Likes
Message 7 of 16

Alfred.NESWADBA
Consultant
Consultant

Hi,

 

>> when i see the property of that layer "by selecting layer and right click" some option is not active

Some options are disabled when geometry is in edit-state or checked out.

After checking in all features you should get back all context-menu items.

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
ISH-Solutions GmbH / Ingenieur Studio HOLLAUS
www.ish-solutions.at ... blog.ish-solutions.at ... LinkedIn ... CDay 2026
------------------------------------------------------------------------------------

(not an Autodesk consultant)
0 Likes
Message 8 of 16

Anonymous
Not applicable

Hi sir,

 

can i stylize fdo layer by overrule query through vb.net c# or lisp without using layerdefination xml 

0 Likes
Message 9 of 16

Anonymous
Not applicable

after hiding the features i close the file with save then open it again but hidden features is showing in drawing.

 

i want to hide until i do not allow to show features. please suggest

0 Likes
Message 10 of 16

Alfred.NESWADBA
Consultant
Consultant

Hi,

 

>> after hiding the features i close the file with save then open

>> it again but hidden features is showing in drawing

Which way did you now choose to hide features?

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
ISH-Solutions GmbH / Ingenieur Studio HOLLAUS
www.ish-solutions.at ... blog.ish-solutions.at ... LinkedIn ... CDay 2026
------------------------------------------------------------------------------------

(not an Autodesk consultant)
0 Likes
Message 11 of 16

Anonymous
Not applicable

I used this code to hide fature--

 

Dim currentMap As Autodesk.Gis.Map.Platform.AcMapMap = Autodesk.Gis.Map.Platform.AcMapMap.GetCurrentMap()
' Dim layers As MgLayerCollection = currentMap.GetLayers()

Dim layers As MgLayerCollection = currentMap.GetLayers()
Dim layer As Autodesk.Gis.Map.Platform.AcMapLayer = layers.GetItem("CONDUIT")

Dim query As MgFeatureQueryOptions = New MgFeatureQueryOptions()
query.SetFilter("OBJECTID = 183075")

Dim featureReader As MgFeatureReader = layer.SelectFeatures(query)
Dim selectionSet As Autodesk.Gis.Map.Platform.AcMapSelection = New Autodesk.Gis.Map.Platform.AcMapSelection(currentMap)

selectionSet.AddFeatures(layer, featureReader, 0)

featureReader.Close()

 

If layer.Visible = True Then


layer.SetFeatureVisibility(selectionSet, True)


End If

 

but it is showing erro on this line 

 

layer.SetFeatureVisibility(selectionSet, True)

0 Likes
Message 12 of 16

Anonymous
Not applicable

hi

 

0 Likes
Message 13 of 16

Anonymous
Not applicable
I used this code to hide feature Dim currentMap As Autodesk.Gis.Map.Platform.AcMapMap = Autodesk.Gis.Map.Platform.AcMapMap.GetCurrentMap() ' Dim layers As MgLayerCollection = currentMap.GetLayers() Dim layers As MgLayerCollection = currentMap.GetLayers() Dim layer As Autodesk.Gis.Map.Platform.AcMapLayer = layers.GetItem("CONDUIT") Dim query As MgFeatureQueryOptions = New MgFeatureQueryOptions() query.SetFilter("OBJECTID = 183075") Dim featureReader As MgFeatureReader = layer.SelectFeatures(query) Dim selectionSet As Autodesk.Gis.Map.Platform.AcMapSelection = New Autodesk.Gis.Map.Platform.AcMapSelection(currentMap) selectionSet.AddFeatures(layer, featureReader, 0) featureReader.Close()   If layer.Visible = True Then layer.SetFeatureVisibility(selectionSet, True) End If   but it is showing erro on this line    layer.SetFeatureVisibility(selectionSet, True)
0 Likes
Message 14 of 16

scheel
Advocate
Advocate

Hi,

 

have you checked, that the selectionset is not empty?

The Problem of objectid is that it is not constant. Everytime you open a drawing the objectids are new.

You should use the Featureid or something other that is constant to select the feature.

 

The most important thing is, to show us the error message.

Then we better can help you.

 

Thorsten

Thorsten Scheel
Contelos GmbH













0 Likes
Message 15 of 16

Anonymous
Not applicable

There is no error .

 

When i hide the features and save the drawing and close after that 

 

if i open the same drawing again, hidden feature is available in drawing (which features should be as a hidden mode) i used  another unique column id which is not changeable.

 

NOTE-I have no permit-ion to overwrite in oracle database. oracle database is  just readable mode.

 

suggest.

0 Likes
Message 16 of 16

scheel
Advocate
Advocate

Hi,

 

now I'm a little bit in confusion. You write many times your code and every time I can read " but it is showing erro on this line" at the bottom of your code. Now you write there is no error. So what is true?

 

In message 5 of this chat you write you solved it.

 

To your Problem unable to can refresh, Alfred is right. you have to control if there is any feature be checked out. That could also be a deleted feature.

Then you have first to checkin and then you can refresh.

 

To get the unhide of features permanent but be able to change this, I have a solution:

  1. You connect to a fdo table you have full Access, containing a key to join to your oracle table and a property to switch on/off
  2. You also connect to the oracle table and create the layer in the drawing 
  3. Create a join between the Oracle tabel and your own table
  4. Change teh stylization to recognize the property in your table

Now you only have to change your property in your table to switch on/off and you didn't need write access to oracle.

 

Thorsten

Thorsten Scheel
Contelos GmbH













0 Likes