Good morning.
I’m trying to edit the profile of a wall.
In my code below, I’ve managed to create a wall using the method shown. The wall is created in a basic way, but what I’m trying to do is edit the wall’s profile immediately after its creation. I’ve tried to do this, but without success. The code doesn’t return any runtime errors; it simply seems that it’s not assigning the profile to the wall. I know that “wall_profile = data[3]” is already a list of lists of native Revit lines and not Dynamo lines, where the first sublist is always the outline of the shape I want, and the other sublists are the perforations or openings in the wall. I’ve searched everywhere for something on the subject or how to achieve my goal, but I can’t find a solution or any way forward. Note that I’m using Revit 2023, in Dynamo with CyPython, which uses Python 3.8.10.
The AI queries are only returning errors… so I would greatly appreciate any help in resolving this issue.
Thank you very much.
#region TRATAMIENTO PARA PODER OBTENER SUPERFICIES Y DATOS DEL ELEMENTO.
nivel_elemento = NivelElemento(elemento_recubrimiento_resultante, doc)
nuevo_nivel = MapearNuevoNivel(nivel_elemento, doc)
if solido_recubrimiento_resultante and nuevo_nivel:
superficies_recubrimiento = Geometry.Explode(solido_recubrimiento_resultante)
superficies_exteriores = \[\]
for superficie in superficies_recubrimiento:
evaluacion = Geometry.DoesIntersect(superficie, solido_elemento_resultante)
if evaluacion == False:
superficies_exteriores.append(superficie)
class FailuresPreprocessorPerfil(IFailuresPreprocessor):
def PreprocessFailures(self, failuresAccessor):
return FailureProcessingResult.Continue
for su in superficies_exteriores:
tipo_superficie = TipoSuperficie(su)
if tipo_superficie == "Plana":
tipo_orientacion = OrientacionSuperficie(su)
if tipo_orientacion == "MURO NORMAL":
datos = DatosSuperficiePlanaVertical(su, nuevo_nivel)
altura_muro = datos\[0\]
desfase_muro = datos\[1\]
eje_muro = datos\[2\]
perfil_muro = datos\[3\]
\# Crear muro
TransactionManager.Instance.EnsureInTransaction(doc)
nuevo_muro = Wall.Create(
doc,
eje_muro,
tipo_muro.Id,
nuevo_nivel.Id,
altura_muro \* 3.28084,
desfase_muro \* 3.28084,
False,
False
)
TransactionManager.Instance.TransactionTaskDone()
X.append(nuevo_muro)
\# Editar perfil inmediatamente
if nuevo_muro and nuevo_muro.CanHaveProfileSketch():
sketch_id = nuevo_muro.SketchId
sketch = doc.GetElement(sketch_id) if sketch_id else None
if sketch:
sketchEditScope = SketchEditScope(doc, "Editar perfil de muro")
sketchEditScope.Start(sketch.Id)
t = Transaction(doc, "Modificar perfil de muro")
t.Start()
try:
\# Eliminar curvas existentes
for elId in sketch.GetAllElements():
doc.Delete(elId)
plano_sketch = sketch.SketchPlane
\# Crear curvas del contorno y huecos en orden
for loop in perfil_muro: # primer loop = contorno, demás = huecos
for curva in loop:
doc.Create.NewModelCurve(curva, plano_sketch)
t.Commit()
except Exception as e:
if t.HasStarted():
t.RollBack()
sketchEditScope.Cancel()
raise Exception("Error al modificar perfil del muro: {}".format(e))
sketchEditScope.Commit(FailuresPreprocessorPerfil())
#endregion
OUT = X





