Untitled
unknown
plain_text
a year ago
3.1 kB
8
Indexable
[CommandMethod("M_Pr_Sup")] public void M_Pr_Sup() { // Selecione os Alinhamentos PromptSelectionOptions SelAlin = new PromptSelectionOptions(); SelAlin.MessageForAdding = "Selecione os Alinhaemntos"; TypedValue[] filtro = { new TypedValue((int)DxfCode.Start, "AECC_ALIGNMENT") }; SelectionFilter selecaoFiltro = new SelectionFilter(filtro); PromptSelectionResult SelRes = Manager.DocEditor.GetSelection(SelAlin, selecaoFiltro); if (SelRes.Status != PromptStatus.OK) { Manager.DocEditor.WriteMessage("\nComando Cancelado"); return; } F_CR_Prof_Supercie Janela = new F_CR_Prof_Supercie(); Janela.ShowDialog(); if (!Janela.Fazer) { return; } ObjectId IdEstilo = Manager.DocCivil.Styles.ProfileStyles[Janela.NomeEstiloPerfil]; ObjectId IdLabel = Manager.DocCivil.Styles.LabelSetStyles.ProfileLabelSetStyles[Janela.NomeLabelPerfil]; ObjectId surfaceId = ObjectId.Null; // Obter todas as superfícies no desenho corrente ObjectIdCollection surfaceIds = Manager.DocCivil.GetSurfaceIds(); using (Transaction TrCad = Manager.DocCad.TransactionManager.StartTransaction()) { foreach (ObjectId id in surfaceIds) { TinSurface surface = TrCad.GetObject(id, OpenMode.ForRead) as TinSurface; if (surface != null && surface.Name == Janela.NomeSurfacePerfil) { surfaceId = id; break; } } if (surfaceId == ObjectId.Null) { Manager.DocEditor.WriteMessage("\nSuperfície não encontrada"); return; } } using (DocumentLock Lock = Manager.DocCad.LockDocument()) { using (Transaction TrCad = Manager.DocCad.TransactionManager.StartTransaction()) { LayerTable TabelaLayers = (LayerTable)TrCad.GetObject(Manager.DocData.LayerTableId, OpenMode.ForRead); ObjectId IdLayer = TabelaLayers[Janela.NomeLayerPerfil]; foreach (SelectedObject selObj in SelRes.Value) { Alignment alinhamento = TrCad.GetObject(selObj.ObjectId, OpenMode.ForRead) as Alignment; string profileName = $"{Janela.PrefixoPerfil}{alinhamento.Name}"; ObjectId IDAlinhamento = selObj.ObjectId; Profile.CreateFromSurface(profileName, IDAlinhamento, surfaceId, IdLayer, IdEstilo, IdLabel); } TrCad.Commit(); } } } } }
Editor is loading...
Leave a Comment