public void HideTraverseElement(Document doc) { if (m_allTreeNodeList.Count == 0 || m_allTreeNodeList == null) { return; } foreach (var treenode in m_allTreeNodeList) { Element ele = MtCommon.GetElementById(doc, treenode.Id.ToString()); MtCommon.HideElementTemporary(doc, ele); } m_allTreeNodeList.Clear(); }
private void BasicInfoListView_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (e.Source is System.Windows.Controls.ListView) { BasicInfoError error = BasicInfoListView.SelectedItem as BasicInfoError; if (error != null && error is BasicInfoError) { string id = error.ID; Element element = MtCommon.GetElementById(m_uidoc.Document, id); MtCommon.ElementCenterDisplay(m_uidoc, element); IList <ElementId> list = new List <ElementId>(); list.Add(element.Id); m_uidoc.Selection.SetElementIds(list); } } }
public void AutoAdjustLevel() { GetALLLevelOffset(); foreach (var item in m_dicLevelErrors) { Element ele = MtCommon.GetElementById(m_uIDocument.Document, item.Key); if (ele != null) { string offset = MtCommon.GetOneParameter(ele, MtCommon.GetStringValue(MtGlobals.Parameters.Offset)); string startOffset = MtCommon.GetOneParameter(ele, MtCommon.GetStringValue(MtGlobals.Parameters.StartOffset)); string endOffset = MtCommon.GetOneParameter(ele, MtCommon.GetStringValue(MtGlobals.Parameters.EndOffset)); string _level = string.Empty; string level = MtCommon.GetOneParameter(ele, MtCommon.GetStringValue(MtGlobals.Parameters.Level)); if (string.IsNullOrEmpty(level) || level.Equals(MtGlobals.Parameters.NoParam.ToString())) { _level = MtCommon.GetOneParameter(ele, MtCommon.GetStringValue(MtGlobals.Parameters.ReferenceLevel)); } else { _level = level; } string correctLevel = string.Empty; double offsetValue = double.Parse(offset); double correctOffsetValue = offsetValue; if (offsetValue > 0) { bool isFirst = false; for (int i = 0; i < m_listLevelOffset.Count; i++) { LevelOffset leveloffset = m_listLevelOffset[i]; if (leveloffset.levelName != _level && !isFirst) { continue; } else { isFirst = true; if (correctOffsetValue >= leveloffset.levelOffsetValue) { correctOffsetValue -= leveloffset.levelOffsetValue; } else { correctLevel = leveloffset.levelName; break; //获得正确标高跳出 } } } } else { bool isFirst = false; correctOffsetValue = Math.Abs(offsetValue); for (int i = m_listLevelOffset.Count - 1; i >= 0; i--) { LevelOffset leveloffset = m_listLevelOffset[i]; if (leveloffset.levelName != _level && !isFirst) { continue; } else { isFirst = true; if (correctOffsetValue >= leveloffset.levelOffsetValue) { correctOffsetValue -= leveloffset.levelOffsetValue; } else { correctLevel = leveloffset.levelName; break; } } } } if (string.IsNullOrEmpty(level) || level.Equals(MtGlobals.Parameters.NoParam.ToString())) { if (m_levels != null && m_levels.ContainsKey(correctLevel)) { Parameter param = ele.LookupParameter(MtCommon.GetStringValue(MtGlobals.Parameters.ReferenceLevel)); if (param != null) { param.Set(m_levels[correctLevel].LevelId); } } } else { if (m_levels != null && m_levels.ContainsKey(correctLevel)) { ele.LookupParameter(MtCommon.GetStringValue(MtGlobals.Parameters.Offset)).Set(correctOffsetValue); Parameter param = ele.LookupParameter(MtCommon.GetStringValue(MtGlobals.Parameters.Level)); } } } } CheckPipeLevel(); }