Untitled

mail@pastecode.io avatar
unknown
csharp
a month ago
1.4 kB
4
Indexable
Never
 try
 {
     ObjectIdCollection alignments = Manager.DocCivil.GetAlignmentIds();
     foreach (ObjectId alignmentId in alignments)
     {
         Alignment alignment = trCad.GetObject(alignmentId, OpenMode.ForRead) as Alignment;
         if (alignment == null) continue;
        if (alignment.GetProfileViewIds().Count == 0 )
         {
             string projectName = $"{janela.PrefixoPerfil}{alignment.Name}";
             bool ExistePerfil = false;
             foreach(ObjectId IDPerfil in alignment.GetProfileIds())
             {
                 Profile PerfilAtual = trCad.GetObject(IDPerfil, OpenMode.ForRead) as Profile;
                 if (PerfilAtual.Name == projectName)
                 {
                     ExistePerfil = true;
                 }
             }
             if (!ExistePerfil)
             {
                 Profile profile = CreateProfile(trCad, alignment, projectName, idLayer, idEstilo, idLabel);
                 AdjustProfileElevations(trCad, profile, alignment);
                 Manager.DocEditor.WriteMessage($"\nPerfil de projeto '{projectName}' criado para o alinhamento '{alignment.Name}'.");
             }              
         }        
     }
     trCad.Commit();
 }
 catch (System.Exception ex)
 {
     Manager.DocEditor.WriteMessage($"\nErro: {ex.Message}");
 }
Leave a Comment