Announcements
Due to scheduled maintenance, the Autodesk Community will be inaccessible from 10:00PM PDT on Oct 16th for approximately 1 hour. We appreciate your patience during this time.
Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Error Codigo Selección de Elementos

3 REPLIES 3
Reply
Message 1 of 4
elvisalex
422 Views, 3 Replies

Error Codigo Selección de Elementos

Buen día, tengo el siguiente error en mi siguiente Script, en Sharp DEVELOP

ERROR.JPG

les dejo el codigo para que me puedan orientar con la solución

 

public void C4_M2_SeleccionElementos()
		{
			UIDocument uidoc = this.ActiveUIDocument;
			Document doc = uidoc.Document;
			StringBuilder sbuilder = new StringBuilder();
			
			Reference ref_pickobject_element = uidoc.Selection.PickObject(ObjectType.Element,"SELECIONA UN ELEMENTO");
			Element elemento_pickobject_element = doc.GetElement(ref_pickobject_element);
			sbuilder.AppendLine("PICKOBJECT ELEMENTO: "+elemento_pickobject_element.Name);
			
			sbuilder.AppendLine();
			
			IList<Reference> refs_pickobject = uidoc.Selection.PickObjects(ObjectType.Element,"SELECCIONA VARIOS OBJETOS");
			sbuilder.AppendLine("PICKOBJECTS");
			
			foreach (Reference ref_elem in refs_pickobject)
			{
				Element e_seleccionado = doc.GetElement(ref_elem);
				sbuilder.AppendLine(e_seleccionado.Name);
				
			}
			
			sbuilder.AppendLine();
			sbuilder.AppendLine("PICKED BY RECTANGLE");
			List<Element> lista_pickedbyrectangle = uidoc.Selection.PickElementsByRectangle("SELECCIONA CON UN RECTANGULO").ToList();//TRANSFORMANDO EN LISTA
			foreach (Element elemento in lista_pickedbyrectangle)
			{
				sbuilder.AppendLine(elemento.Name);
			}
			
			TaskDialog.Show("Innova3D&C",sbuilder.ToString());
			
			
			
		}

 

Arquitecto
Elvis A. Quintero P.
Innova3D&C SAC
Labels (1)
3 REPLIES 3
Message 2 of 4
Organon
in reply to: elvisalex

@elvisalex,

 

Hola.

 

Eso sucede cuando presionas ESC durante la ejecución del comando. Tienes que crear un bloque try/catch para gestionar la excepción.

 

Saludos.


Arquitectura | Análisis CAD & BIM | Diseño Paramétrico | Programación
BIM-METADATA | LinkedIn | YouTube
Message 3 of 4
elvisalex
in reply to: Organon

claro, al colocar el Try el Catch ya no me bota la ventana de error, pero no soluciona mi problema.

mensaje.jpg

¿quiza se deba a eso?

Arquitecto
Elvis A. Quintero P.
Innova3D&C SAC
Message 4 of 4
Organon
in reply to: elvisalex

@elvisalex,

 

Eso que te sale, ya es un problema diferente.

 

Saludos.


Arquitectura | Análisis CAD & BIM | Diseño Paramétrico | Programación
BIM-METADATA | LinkedIn | YouTube

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

Post to forums  

Rail Community


Autodesk Design & Make Report