AutoCAD Map 3D Developer
Welcome to Autodesk’s AutoCAD Map 3D Developer Forums. Share your knowledge, ask questions, and explore popular AutoCAD Map 3D Developer topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

update layer from c#

8 REPLIES 8
Reply
Message 1 of 9
jcortega
1145 Views, 8 Replies

update layer from c#

jcortega
Participant
Participant

 

Hello!,

I use fdo and c# to connect to spatial data base postgis from Autocad Map 3D, when I insert a new element to a table , the database update attribute 'id' and 'id_rev' (primary key)  from a sequence, but in Autocad Map 3d 2014 it appears the new record whith     id and id_rev as nulls, and then i can´t modify or delete the entity from Autocad Map

 

Only when I execute update layer manually, this attributes obtain the new value, and then I can modify or delete this new record. How I update the layer from the code?.

 

I use layer.forceRefresh() after of :

 

MgInsertFeatures insertarElementos = new MgInsertFeatures(featureclassName, propiedades);
MgFeatureCommandCollection comandos = new MgFeatureCommandCollection();
comandos.Add(insertarElementos);

layer.forceRefresh()

 

But, layer.forceRefresh() doesn´t work.

 

I'd appreciate any help

 

 

 

0 Likes

update layer from c#

 

Hello!,

I use fdo and c# to connect to spatial data base postgis from Autocad Map 3D, when I insert a new element to a table , the database update attribute 'id' and 'id_rev' (primary key)  from a sequence, but in Autocad Map 3d 2014 it appears the new record whith     id and id_rev as nulls, and then i can´t modify or delete the entity from Autocad Map

 

Only when I execute update layer manually, this attributes obtain the new value, and then I can modify or delete this new record. How I update the layer from the code?.

 

I use layer.forceRefresh() after of :

 

MgInsertFeatures insertarElementos = new MgInsertFeatures(featureclassName, propiedades);
MgFeatureCommandCollection comandos = new MgFeatureCommandCollection();
comandos.Add(insertarElementos);

layer.forceRefresh()

 

But, layer.forceRefresh() doesn´t work.

 

I'd appreciate any help

 

 

 

8 REPLIES 8
Message 2 of 9
Koesti
in reply to: jcortega

Koesti
Autodesk Support
Autodesk Support

Hi @jcortega,

do we have the same situation with one of the current versions e.g. Map 3D 2019/2020?

I know that there has been some changes for Postgres provider since version 2014.

If that also not work please let me know and I will ask the question to the developer.

Regards

 



Brigitte Koesterke

Technical Support Senior Specialist
0 Likes

Hi @jcortega,

do we have the same situation with one of the current versions e.g. Map 3D 2019/2020?

I know that there has been some changes for Postgres provider since version 2014.

If that also not work please let me know and I will ask the question to the developer.

Regards

 



Brigitte Koesterke

Technical Support Senior Specialist
Message 3 of 9
Koesti
in reply to: jcortega

Koesti
Autodesk Support
Autodesk Support

Hi @jcortega,

if it is still not working with current versions it might be another idea to transfer the request to the developer forum.

Please send us short feedback about how we can help.

Regards



Brigitte Koesterke

Technical Support Senior Specialist
0 Likes

Hi @jcortega,

if it is still not working with current versions it might be another idea to transfer the request to the developer forum.

Please send us short feedback about how we can help.

Regards



Brigitte Koesterke

Technical Support Senior Specialist
Message 4 of 9
jcortega
in reply to: Koesti

jcortega
Participant
Participant

Hi Brigitte, we have updated our postgresql client and libraries according to our server version.

We have a table (for example diseminado_abastecimiento) defined as:

CREATE TABLE encuesta.rev_t_diseminado_abastecimiento (
	id bigserial NOT NULL,
	geom geometry NULL,
	capa varchar(254) NULL,
	material varchar(2) NULL,
	diametro varchar(7) NULL,
	estado varchar(1) NULL,
	municipio varchar(3) NULL,
	longitud float8 NULL,
	id_rev bigserial NOT NULL,
	validez tstzrange NULL,
	CONSTRAINT diseminado_abastecimiento_material CHECK (((material)::text = ANY ((ARRAY['PC'::character varying, 'FU'::character varying, 'PE'::character varying, 'HO'::character varying, 'FC'::character varying, 'PL'::character varying, 'PV'::character varying, 'PB'::character varying, 'OT'::character varying])::text[]))),
	CONSTRAINT rev_t_diseminado_abastecimiento_id_validez_excl EXCLUDE USING gist (id WITH =, validez WITH &&),
	CONSTRAINT rev_t_diseminado_abastecimiento_pkey PRIMARY KEY (id_rev)
);
CREATE INDEX rev_t_diseminado_abastecimiento_id_validez_excl ON encuesta.rev_t_diseminado_abastecimiento USING gist (id, validez);
COMMENT ON TABLE encuesta.rev_t_diseminado_abastecimiento IS 'Conducciones de abastecimiento de diseminados utilizada por las tabletas y aplicación de Autocad.';

Some of this data are automatically filled by postgresql instance when insert/update data, for example id and id_rev.

 

The main problem is that when I insert new data from FDO/C# application, the record is correctly stored in database (id and id_rev field obtains its values) but in Autocad this values are null as you can see in attached image. Only when we update the layer manually (clicking with secondary mouse button on the layer and selecting Update layer) the record is correctly updated on Autocad side.

 

How can I update the layer from FDO/c# code retrieving the current data from database?

 

I've found a question related to this issue but without answer: https://forums.autodesk.com/t5/autocad-map-3d-forum/auto-refresh-layer-after-inserting-a-feature-in-... .

Regards.

0 Likes

Hi Brigitte, we have updated our postgresql client and libraries according to our server version.

We have a table (for example diseminado_abastecimiento) defined as:

CREATE TABLE encuesta.rev_t_diseminado_abastecimiento (
	id bigserial NOT NULL,
	geom geometry NULL,
	capa varchar(254) NULL,
	material varchar(2) NULL,
	diametro varchar(7) NULL,
	estado varchar(1) NULL,
	municipio varchar(3) NULL,
	longitud float8 NULL,
	id_rev bigserial NOT NULL,
	validez tstzrange NULL,
	CONSTRAINT diseminado_abastecimiento_material CHECK (((material)::text = ANY ((ARRAY['PC'::character varying, 'FU'::character varying, 'PE'::character varying, 'HO'::character varying, 'FC'::character varying, 'PL'::character varying, 'PV'::character varying, 'PB'::character varying, 'OT'::character varying])::text[]))),
	CONSTRAINT rev_t_diseminado_abastecimiento_id_validez_excl EXCLUDE USING gist (id WITH =, validez WITH &&),
	CONSTRAINT rev_t_diseminado_abastecimiento_pkey PRIMARY KEY (id_rev)
);
CREATE INDEX rev_t_diseminado_abastecimiento_id_validez_excl ON encuesta.rev_t_diseminado_abastecimiento USING gist (id, validez);
COMMENT ON TABLE encuesta.rev_t_diseminado_abastecimiento IS 'Conducciones de abastecimiento de diseminados utilizada por las tabletas y aplicación de Autocad.';

Some of this data are automatically filled by postgresql instance when insert/update data, for example id and id_rev.

 

The main problem is that when I insert new data from FDO/C# application, the record is correctly stored in database (id and id_rev field obtains its values) but in Autocad this values are null as you can see in attached image. Only when we update the layer manually (clicking with secondary mouse button on the layer and selecting Update layer) the record is correctly updated on Autocad side.

 

How can I update the layer from FDO/c# code retrieving the current data from database?

 

I've found a question related to this issue but without answer: https://forums.autodesk.com/t5/autocad-map-3d-forum/auto-refresh-layer-after-inserting-a-feature-in-... .

Regards.

Message 5 of 9
jcortega
in reply to: Koesti

jcortega
Participant
Participant

Hello!

 Have you seen some of this issue , please?

Regards,

José Carlos

 

0 Likes

Hello!

 Have you seen some of this issue , please?

Regards,

José Carlos

 

Message 6 of 9
Koesti
in reply to: jcortega

Koesti
Autodesk Support
Autodesk Support

Hi @jcortega,

thank you for the update and this question need to be answered by a programmer.

Another possibility to get help from C# specialist might be to create a support case with Autodesk Developer Network (ADN).

Would it be OK if I move the case to Map 3D developer forum?

Regards



Brigitte Koesterke

Technical Support Senior Specialist
0 Likes

Hi @jcortega,

thank you for the update and this question need to be answered by a programmer.

Another possibility to get help from C# specialist might be to create a support case with Autodesk Developer Network (ADN).

Would it be OK if I move the case to Map 3D developer forum?

Regards



Brigitte Koesterke

Technical Support Senior Specialist
Message 7 of 9
jcortega
in reply to: Koesti

jcortega
Participant
Participant

Hello, thank you for your attention.

 

Please, consult to your programmer team and if you want you can also through this question to the ADN and/or Map 3D developer forum. I don't know which is the best way to resolve this issue.

 

I'll wait for your answer and if I should do anything else, please tell me what must I do.

 

Regards.

0 Likes

Hello, thank you for your attention.

 

Please, consult to your programmer team and if you want you can also through this question to the ADN and/or Map 3D developer forum. I don't know which is the best way to resolve this issue.

 

I'll wait for your answer and if I should do anything else, please tell me what must I do.

 

Regards.

Message 8 of 9
jcortega
in reply to: Koesti

jcortega
Participant
Participant

Hello, 

  You were able to pass the problem on to the programmers, can they give a solution about updating layer from c#?

Regards,

José Carlos

 

0 Likes

Hello, 

  You were able to pass the problem on to the programmers, can they give a solution about updating layer from c#?

Regards,

José Carlos

 

Message 9 of 9
jcortega
in reply to: Koesti

jcortega
Participant
Participant

 

+Hello Brigitte.Koesterke, are there news about this issue?

It is important for our.

Regards.

0 Likes

 

+Hello Brigitte.Koesterke, are there news about this issue?

It is important for our.

Regards.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report