/// <summary> /// Performs the export of elements, including spatial and non-spatial elements. /// </summary> /// <param name="exporterIFC">The IFC exporter object.</param> /// <param name="element ">The element to export.</param> public virtual void ExportElement(ExporterIFC exporterIFC, Autodesk.Revit.DB.Element element) { if (!CanExportElement(exporterIFC, element)) { if (element is RevitLinkInstance && !ExporterCacheManager.ExportOptionsCache.ExportingLink) { IDictionary<String, String> options = exporterIFC.GetOptions(); bool? bExportLinks = ExportOptionsCache.GetNamedBooleanOption(options, "ExportLinkedFiles"); if (bExportLinks.HasValue && bExportLinks.Value == true) { bool bStoreIFCGUID = ExporterCacheManager.ExportOptionsCache.GUIDOptions.StoreIFCGUID; ExporterCacheManager.ExportOptionsCache.GUIDOptions.StoreIFCGUID = true; GUIDUtil.CreateGUID(element); ExporterCacheManager.ExportOptionsCache.GUIDOptions.StoreIFCGUID = bStoreIFCGUID; } } return; } //WriteIFCExportedElements if (m_Writer != null) { Category category = element.Category; m_Writer.WriteLine(String.Format("{0},{1},{2}", element.Id, category == null ? "null" : category.Name, element.GetType().Name)); } try { using (ProductWrapper productWrapper = ProductWrapper.Create(exporterIFC, true)) { ExportElementImpl(exporterIFC, element, productWrapper); ExporterUtil.ExportRelatedProperties(exporterIFC, element, productWrapper); } // We are going to clear the parameter cache for the element (not the type) after the export. // We do not expect to need the parameters for this element again, so we can free up the space. if (!(element is ElementType) && !ExporterStateManager.ShouldPreserveElementParameterCache(element)) ParameterUtil.RemoveElementFromCache(element); } catch (System.Exception ex) { HandleUnexpectedException(ex, exporterIFC, element); } }
/// <summary> /// Performs the export of elements, including spatial and non-spatial elements. /// </summary> /// <param name="exporterIFC">The IFC exporter object.</param> /// <param name="element ">The element to export.</param> public virtual void ExportElement(ExporterIFC exporterIFC, Autodesk.Revit.DB.Element element) { if (!CanExportElement(exporterIFC, element)) return; //WriteIFCExportedElements if (m_Writer != null) { Category category = element.Category; m_Writer.WriteLine(String.Format("{0},{1},{2}", element.Id, category == null ? "null" : category.Name, element.GetType().Name)); } try { using (ProductWrapper productWrapper = ProductWrapper.Create(exporterIFC, true)) { ExportElementImpl(exporterIFC, element, productWrapper); ExporterUtil.ExportRelatedProperties(exporterIFC, element, productWrapper); } // We are going to clear the parameter cache for the element (not the type) after the export. // We do not expect to need the parameters for this element again, so we can free up the space. if (!(element is ElementType) && !ExporterStateManager.ShouldPreserveElementParameterCache(element)) ParameterUtil.RemoveElementFromCache(element); } catch (System.Exception ex) { HandleUnexpectedException(ex, exporterIFC, element); } }
// Note: Some element does not expose geometry, for example, curtain wall and dimension. // In case of a curtain wall, try selecting a whole wall by a window/box instead of a single pick. // It will then select internal components and be able to display its geometry. // public void SendElement(Autodesk.Revit.DB.Element elem) { if (elem.GetType() == typeof(Autodesk.Revit.DB.Element)) { return; } if (elem is Autodesk.Revit.DB.TextNote) { sendTextNote(elem); } if (elem is Autodesk.Revit.DB.View) { sendViewpoint(elem); } // if it is a Group. we will need to look at its components. if (elem is Autodesk.Revit.DB.Group) { /* if we add this, the elements of the Group are duplicates Autodesk.Revit.DB.Group @group = (Autodesk.Revit.DB.Group)elem; Autodesk.Revit.DB.ElementArray members = @group.GetMemberIds; MessageBuffer mb = new MessageBuffer(); mb.add(elem.Id.IntegerValue); mb.add(elem.Name); sendMessage(mb.buf, MessageTypes.NewGroup); foreach (Autodesk.Revit.DB.Element elm in members) { SendElement(elm); } mb = new MessageBuffer(); sendMessage(mb.buf, MessageTypes.EndGroup);*/ } else { // not a group. look at the geom data. Autodesk.Revit.DB.GeometryElement geom = elem.get_Geometry(mOptions); if ((geom != null)) { SendElement(geom, elem); } } }
/// <summary> /// Performs the export of elements, including spatial and non-spatial elements. /// </summary> /// <param name="exporterIFC">The IFC exporter object.</param> /// <param name="filterView">The view whose filter visibility settings govern the export.</param> /// <param name="element ">The element to export.</param> internal void ExportElement(ExporterIFC exporterIFC, Autodesk.Revit.DB.View filterView, Autodesk.Revit.DB.Element element) { if (!ElementFilteringUtil.ShouldCategoryBeExported(exporterIFC, element)) return; // if we allow exporting parts as independent building elements, then prevent also exporting the host elements containing the parts. if (ExporterCacheManager.ExportOptionsCache.ExportPartsAsBuildingElements && PartExporter.CanExportParts(element)) return; //WriteIFCExportedElements if (m_Writer != null) { Category category = element.Category; m_Writer.WriteLine(String.Format("{0},{1},{2}", element.Id, category == null ? "null" : category.Name, element.GetType().Name)); } try { using (IFCProductWrapper productWrapper = IFCProductWrapper.Create(exporterIFC, true)) { ExportElementImpl(exporterIFC, element, filterView, productWrapper); ExportElementProperties(exporterIFC, element, productWrapper); ExportElementQuantities(exporterIFC, element, productWrapper); if (ExporterCacheManager.ExportOptionsCache.FileVersion == IFCVersion.IFCCOBIE) ExportElementClassifications(exporterIFC, element, productWrapper); } } catch (System.Exception ex) { HandleUnexpectedException(ex, exporterIFC, element); } }
/// <summary> /// Performs the export of elements, including spatial and non-spatial elements. /// </summary> /// <param name="exporterIFC">The IFC exporter object.</param> /// <param name="filterView">The view whose filter visibility settings govern the export.</param> /// <param name="element ">The element to export.</param> public virtual void ExportElement(ExporterIFC exporterIFC, Autodesk.Revit.DB.View filterView, Autodesk.Revit.DB.Element element) { if (!CanExportElement(exporterIFC, filterView, element)) return; //WriteIFCExportedElements if (m_Writer != null) { Category category = element.Category; m_Writer.WriteLine(String.Format("{0},{1},{2}", element.Id, category == null ? "null" : category.Name, element.GetType().Name)); } try { using (ProductWrapper productWrapper = ProductWrapper.Create(exporterIFC, true)) { ExportElementImpl(exporterIFC, element, filterView, productWrapper); // Export PropertySet, Quantity (if set) and Classification (or Uniformat for COBIE) here ExportElementProperties(exporterIFC, element, productWrapper); if (ExporterCacheManager.ExportOptionsCache.ExportBaseQuantities && !(ExporterCacheManager.ExportOptionsCache.FileVersion == IFCVersion.IFCCOBIE)) ExportElementQuantities(exporterIFC, element, productWrapper); ExportElementClassifications(exporterIFC, element, productWrapper); // Exporting ClassificationCode from IFC parameter if (ExporterCacheManager.ExportOptionsCache.FileVersion == IFCVersion.IFCCOBIE) ExportElementUniformatClassifications(exporterIFC, element, productWrapper); } // We are going to clear the parameter cache for the element (not the type) after the export. // We do not expect to need the parameters for this element again, so we can free up the space. if (!(element is ElementType)) ParameterUtil.RemoveElementFromCache(element); } catch (System.Exception ex) { HandleUnexpectedException(ex, exporterIFC, element); } }
private Double GetLength(Autodesk.AutoCAD.DatabaseServices.DBObject dbobj) { try { Double result = 0.0d; if (dbobj.GetType().Name == "Polyline") { result = (dbobj as Autodesk.AutoCAD.DatabaseServices.Polyline).Length; } else if (dbobj.GetType().Name == "Line") { result = (dbobj as Autodesk.AutoCAD.DatabaseServices.Line).Length; } else if (dbobj.GetType().Name == "Arc") { result = (dbobj as Autodesk.AutoCAD.DatabaseServices.Arc).Length; } else if (dbobj.GetType().Name == "Circle") { result = (dbobj as Autodesk.AutoCAD.DatabaseServices.Circle).Circumference; } return result; } catch (System.Exception ex) { AcadApp.AcaEd.WriteMessage("ERROR: MarkingCalc().GetLength " + ex + "\n"); } return -1.0d; }
private Double GetArea(Autodesk.AutoCAD.DatabaseServices.DBObject dbobj) { Double result = 0.0d; try { if (dbobj.GetType().Name == "Polyline") { result = (dbobj as Autodesk.AutoCAD.DatabaseServices.Polyline).Area; } else if (dbobj.GetType().Name == "Circle") { result = (dbobj as Autodesk.AutoCAD.DatabaseServices.Circle).Area; } } catch (System.Exception ex) { AcadApp.AcaEd.WriteMessage("ERROR: MarkingCalc().GetArea " + ex + "\n"); } return result; }
/// <summary> /// Performs the export of elements, including spatial and non-spatial elements. /// </summary> /// <param name="exporterIFC">The IFC exporter object.</param> /// <param name="filterView">The view whose filter visibility settings govern the export.</param> /// <param name="element ">The element to export.</param> internal void ExportElement(ExporterIFC exporterIFC, Autodesk.Revit.DB.View filterView, Autodesk.Revit.DB.Element element) { //current view only if (filterView != null && !ElementFilteringUtil.IsElementVisible(filterView, element)) return; // if (!ElementFilteringUtil.ShouldCategoryBeExported(exporterIFC, element)) return; //WriteIFCExportedElements if (m_Writer != null) { Category category = element.Category; m_Writer.WriteLine(String.Format("{0},{1},{2}", element.Id, category == null ? "null" : category.Name, element.GetType().Name)); } try { using (IFCProductWrapper productWrapper = IFCProductWrapper.Create(exporterIFC, true)) { if (IsElementSupportedExternally(exporterIFC, element)) { ExportElementImpl(exporterIFC, element, productWrapper); } else ExporterIFCUtils.ExportElementInternal(exporterIFC, element, productWrapper); ExportElementProperties(exporterIFC, element, productWrapper); ExportElementQuantities(exporterIFC, element, productWrapper); } } catch (System.Exception ex) { string errMsg = String.Format("IFC error: Exporting element \"{0}\",{1} - {2}", element.Name, element.Id, ex.ToString()); element.Document.Application.WriteJournalComment(errMsg, true); } }
private Double GetLength(Autodesk.AutoCAD.DatabaseServices.DBObject dbobj) { Double result = 0.0d; if (dbobj.GetType().Name == "Polyline") { result = (dbobj as Autodesk.AutoCAD.DatabaseServices.Polyline).Length; } else if (dbobj.GetType().Name == "Line") { result = (dbobj as Autodesk.AutoCAD.DatabaseServices.Line).Length; } else if (dbobj.GetType().Name == "Arc") { result = (dbobj as Autodesk.AutoCAD.DatabaseServices.Arc).Length; } else if (dbobj.GetType().Name == "Circle") { result = (dbobj as Autodesk.AutoCAD.DatabaseServices.Circle).Circumference; } return result; }
private Double GetArea(Autodesk.AutoCAD.DatabaseServices.DBObject dbobj) { Double result = 0.0d; if (dbobj.GetType().Name == "Polyline") { result = (dbobj as Autodesk.AutoCAD.DatabaseServices.Polyline).Area; } else if (dbobj.GetType().Name == "Circle") { result = (dbobj as Autodesk.AutoCAD.DatabaseServices.Circle).Area; } return result; }