本文整理汇总了C#中IFCAnyHandle类的典型用法代码示例。如果您正苦于以下问题:C# IFCAnyHandle类的具体用法?C# IFCAnyHandle怎么用?C# IFCAnyHandle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IFCAnyHandle类属于命名空间,在下文中一共展示了IFCAnyHandle类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Process
override protected void Process(IFCAnyHandle ifcPolyLoop)
{
base.Process(ifcPolyLoop);
List<IFCAnyHandle> ifcPolygon =
IFCAnyHandleUtil.GetAggregateInstanceAttribute<List<IFCAnyHandle>>(ifcPolyLoop, "Polygon");
if (ifcPolygon == null)
return; // TODO: WARN
Polygon = IFCPoint.ProcessScaledLengthIFCCartesianPoints(ifcPolygon);
int numVertices = Polygon.Count;
if (numVertices > 1)
{
if (Polygon[0].IsAlmostEqualTo(Polygon[numVertices - 1]))
{
// LOG: Warning: #: First and last points are almost identical, removing extra point.
Polygon.RemoveAt(numVertices - 1);
numVertices--;
}
}
if (numVertices < 3)
throw new InvalidOperationException("#" + ifcPolyLoop.StepId + ": Polygon attribute has only " + numVertices + " vertices, 3 expected.");
}
示例2: Process
protected override void Process(IFCAnyHandle ifcCurve)
{
base.Process(ifcCurve);
IFCAnyHandle basisCurve = IFCImportHandleUtil.GetRequiredInstanceAttribute(ifcCurve, "BasisCurve", false);
if (basisCurve == null)
return;
IFCAnyHandle dir = IFCImportHandleUtil.GetRequiredInstanceAttribute(ifcCurve, "RefDirection", false);
bool found = false;
double distance = IFCImportHandleUtil.GetRequiredScaledLengthAttribute(ifcCurve, "Distance", out found);
if (!found)
distance = 0.0;
IFCCurve ifcBasisCurve = IFCCurve.ProcessIFCCurve(basisCurve);
XYZ dirXYZ = (dir == null) ? ifcBasisCurve.GetNormal() : IFCPoint.ProcessNormalizedIFCDirection(dir);
try
{
if (ifcBasisCurve.Curve != null)
Curve = ifcBasisCurve.Curve.CreateOffset(distance, XYZ.BasisZ);
else if (ifcBasisCurve.CurveLoop != null)
CurveLoop = CurveLoop.CreateViaOffset(ifcBasisCurve.CurveLoop, distance, XYZ.BasisZ);
}
catch
{
Importer.TheLog.LogError(ifcCurve.StepId, "Couldn't create offset curve.", false);
}
}
示例3: Process
/// <summary>
/// Processes an IfcWindowLiningProperties entity.
/// </summary>
/// <param name="ifcWindowLiningProperties">The IfcWindowLiningProperties handle.</param>
protected override void Process(IFCAnyHandle ifcWindowLiningProperties)
{
base.Process(ifcWindowLiningProperties);
if (m_WindowLiningPropertyDescs == null)
{
m_WindowLiningPropertyDescs = new List<Tuple<string, UnitType, AllowedValues>>();
m_WindowLiningPropertyDescs.Add(new Tuple<string, UnitType, AllowedValues>("LiningDepth", UnitType.UT_Length, AllowedValues.Positive));
m_WindowLiningPropertyDescs.Add(new Tuple<string, UnitType, AllowedValues>("LiningThickness", UnitType.UT_Length, AllowedValues.Positive));
m_WindowLiningPropertyDescs.Add(new Tuple<string, UnitType, AllowedValues>("TransomThickness", UnitType.UT_Length, AllowedValues.Positive));
m_WindowLiningPropertyDescs.Add(new Tuple<string, UnitType, AllowedValues>("MullionThickness", UnitType.UT_Length, AllowedValues.Positive));
m_WindowLiningPropertyDescs.Add(new Tuple<string, UnitType, AllowedValues>("FirstTransomOffset", UnitType.UT_Length, AllowedValues.NonNegative));
m_WindowLiningPropertyDescs.Add(new Tuple<string, UnitType, AllowedValues>("SecondTransomOffset", UnitType.UT_Length, AllowedValues.NonNegative));
m_WindowLiningPropertyDescs.Add(new Tuple<string, UnitType, AllowedValues>("FirstMullionOffset", UnitType.UT_Length, AllowedValues.NonNegative));
m_WindowLiningPropertyDescs.Add(new Tuple<string, UnitType, AllowedValues>("SecondMullionOffset", UnitType.UT_Length, AllowedValues.NonNegative));
}
for (int ii = 0; ii < 4; ii++)
{
Tuple<string, UnitType, AllowedValues> propertyDesc = m_WindowLiningPropertyDescs[ii];
// Default is nonsense value.
double currPropertyValue = IFCImportHandleUtil.GetOptionalScaledLengthAttribute(ifcWindowLiningProperties, propertyDesc.Item1, -1e+30);
if (!MathUtil.IsAlmostEqual(currPropertyValue , -1e+30))
DoubleProperties[propertyDesc] = currPropertyValue;
}
for (int ii = 4; ii < 8; ii++)
{
Tuple<string, UnitType, AllowedValues> propertyDesc = m_WindowLiningPropertyDescs[ii];
// Default is nonsense value.
double currPropertyValue = IFCImportHandleUtil.GetOptionalDoubleAttribute(ifcWindowLiningProperties, propertyDesc.Item1, -1e+30);
if (!MathUtil.IsAlmostEqual(currPropertyValue, -1e+30))
DoubleProperties[propertyDesc] = currPropertyValue;
}
}
示例4: Process
override protected void Process(IFCAnyHandle item)
{
base.Process(item);
LayerAssignment = IFCPresentationLayerAssignment.GetTheLayerAssignment(item);
List<IFCAnyHandle> styledByItems = IFCAnyHandleUtil.GetAggregateInstanceAttribute<List<IFCAnyHandle>>(item, "StyledByItem");
if (styledByItems != null && styledByItems.Count > 0)
{
// We can only handle one styled item, but we allow the possiblity that there are duplicates. Do a top-level check.
foreach (IFCAnyHandle styledByItem in styledByItems)
{
if (!IFCAnyHandleUtil.IsSubTypeOf(styledByItem, IFCEntityType.IfcStyledItem))
{
Importer.TheLog.LogUnexpectedTypeError(styledByItem, IFCEntityType.IfcStyledItem, false);
StyledByItem = null;
break;
}
else
{
if (StyledByItem == null)
StyledByItem = IFCStyledItem.ProcessIFCStyledItem(styledByItem);
else
{
IFCStyledItem compStyledByItem = IFCStyledItem.ProcessIFCStyledItem(styledByItem);
if (!StyledByItem.IsEquivalentTo(compStyledByItem))
{
Importer.TheLog.LogWarning(Id, "Multiple inconsistent styled items found for this item; using first one.", false);
break;
}
}
}
}
}
}
示例5: CreateUniformatClassification
/// <summary>
/// Creates uniformat classification.
/// </summary>
/// <param name="exporterIFC">The ExporterIFC.</param>
/// <param name="file">The file.</param>
/// <param name="element">The element.</param>
/// <param name="elemHnd">The element handle.</param>
public static void CreateUniformatClassification(ExporterIFC exporterIFC, IFCFile file, Element element, IFCAnyHandle elemHnd)
{
// Create Uniformat classification, if it is not set.
string uniformatKeyString = "Uniformat";
string uniformatCode = "";
if (ParameterUtil.GetStringValueFromElementOrSymbol(element, BuiltInParameter.UNIFORMAT_CODE, false, out uniformatCode) == null)
ParameterUtil.GetStringValueFromElementOrSymbol(element, "Assembly Code", out uniformatCode);
string uniformatDescription = "";
if (!String.IsNullOrWhiteSpace(uniformatCode))
{
if (ParameterUtil.GetStringValueFromElementOrSymbol(element, BuiltInParameter.UNIFORMAT_DESCRIPTION, false, out uniformatDescription) == null)
ParameterUtil.GetStringValueFromElementOrSymbol(element, "Assembly Description", out uniformatDescription);
}
IFCAnyHandle classification;
if (!ExporterCacheManager.ClassificationCache.ClassificationHandles.TryGetValue(uniformatKeyString, out classification))
{
classification = IFCInstanceExporter.CreateClassification(file, "http://www.csiorg.net/uniformat", "1998", null, uniformatKeyString);
ExporterCacheManager.ClassificationCache.ClassificationHandles.Add(uniformatKeyString, classification);
}
InsertClassificationReference(exporterIFC, file, element, elemHnd, uniformatKeyString, uniformatCode, uniformatDescription, "http://www.csiorg.net/uniformat" );
}
示例6: Register
/// <summary>
/// Adds the IfcMaterialLayerSet handle to the dictionary.
/// </summary>
/// <param name="elementId">
/// The element elementId.
/// </param>
/// <param name="handle">
/// The IfcMaterialLayerSet handle.
/// </param>
public void Register(ElementId elementId, IFCAnyHandle handle)
{
if (m_ElementIdToMatLayerSetDictionary.ContainsKey(elementId))
return;
m_ElementIdToMatLayerSetDictionary[elementId] = handle;
}
示例7: ProcessIFCRelAssignsToGroup
/// <summary>
/// Processes IfcRelAssignsToGroup.
/// </summary>
/// <param name="isGroupedBy">The IfcRelAssignsToGroup handle.</param>
void ProcessIFCRelAssignsToGroup(IFCAnyHandle isGroupedBy)
{
m_RelatedObjectType = ProcessIFCRelation.ProcessRelatedObjectType(isGroupedBy);
// We will not process the related objects here, as that could cause infinite loops of partially processed items.
// Instead, items will add themselves to their groups as they are processed.
m_IFCRelatedObjects = new HashSet<IFCObjectDefinition>(); // ProcessIFCRelation.ProcessRelatedObjects(isGroupedBy);
}
示例8: Process
/// <summary>
/// Processes IfcSite attributes.
/// </summary>
/// <param name="ifcIFCSite">The IfcSite handle.</param>
protected override void Process(IFCAnyHandle ifcIFCSite)
{
base.Process(ifcIFCSite);
RefElevation = IFCImportHandleUtil.GetOptionalScaledLengthAttribute(ifcIFCSite, "RefElevation", 0.0);
IList<int> refLatitudeList = IFCAnyHandleUtil.GetAggregateIntAttribute<List<int>>(ifcIFCSite, "RefLatitude");
IList<int> refLongitudeList = IFCAnyHandleUtil.GetAggregateIntAttribute<List<int>>(ifcIFCSite, "RefLongitude");
if (refLatitudeList != null)
{
m_RefLatitude = 0.0;
int numLats = Math.Min(refLatitudeList.Count, 4); // Only support up to degress, minutes, seconds, and millionths of seconds.
for (int ii = 0; ii < numLats; ii++)
{
m_RefLatitude += ((double)refLatitudeList[ii]) / GetLatLongScale(ii);
}
}
if (refLongitudeList != null)
{
m_RefLongitude = 0.0;
int numLongs = Math.Min(refLongitudeList.Count, 4); // Only support up to degress, minutes, seconds, and millionths of seconds.
for (int ii = 0; ii < numLongs; ii++)
{
m_RefLongitude += ((double)refLongitudeList[ii]) / GetLatLongScale(ii);
}
}
m_LandTitleNumber = IFCAnyHandleUtil.GetStringAttribute(ifcIFCSite, "LandTitleNumber");
}
示例9: Export
/// <summary>
/// Exports mullion.
/// </summary>
/// <param name="exporterIFC">
/// The ExporterIFC object.
/// </param>
/// <param name="mullion">
/// The mullion object.
/// </param>
/// <param name="geometryElement">
/// The geometry element.
/// </param>
/// <param name="localPlacement">
/// The local placement handle.
/// </param>
/// <param name="extraParams">
/// The extrusion creation data.
/// </param>
/// <param name="setter">
/// The IFCPlacementSetter.
/// </param>
/// <param name="productWrapper">
/// The IFCProductWrapper.
/// </param>
public static void Export(ExporterIFC exporterIFC, Mullion mullion, GeometryElement geometryElement,
IFCAnyHandle localPlacement, IFCExtrusionCreationData extraParams, IFCPlacementSetter setter, IFCProductWrapper productWrapper)
{
IFCFile file = exporterIFC.GetFile();
ElementId catId = CategoryUtil.GetSafeCategoryId(mullion);
BodyExporterOptions bodyExporterOptions = new BodyExporterOptions(true);
IFCAnyHandle repHnd = RepresentationUtil.CreateBRepProductDefinitionShape(mullion.Document.Application, exporterIFC, mullion, catId,
geometryElement, bodyExporterOptions, null, extraParams);
if (IFCAnyHandleUtil.IsNullOrHasNoValue(repHnd))
{
extraParams.ClearOpenings();
return;
}
string elemGUID = ExporterIFCUtils.CreateGUID(mullion);
IFCAnyHandle ownerHistory = exporterIFC.GetOwnerHistoryHandle();
string elemObjectType = NamingUtil.CreateIFCObjectName(exporterIFC, mullion);
string elemId = NamingUtil.CreateIFCElementId(mullion);
IFCAnyHandle mullionHnd = IFCInstanceExporter.CreateMember(file, elemGUID, ownerHistory, elemObjectType, null, elemObjectType,
localPlacement, repHnd, elemId);
productWrapper.AddElement(mullionHnd, setter, extraParams, LevelUtil.AssociateElementToLevel(mullion));
PropertyUtil.CreateInternalRevitPropertySets(exporterIFC, mullion, productWrapper);
}
示例10: Export
/// <summary>
/// Exports mullion.
/// </summary>
/// <param name="exporterIFC">
/// The ExporterIFC object.
/// </param>
/// <param name="mullion">
/// The mullion object.
/// </param>
/// <param name="geometryElement">
/// The geometry element.
/// </param>
/// <param name="localPlacement">
/// The local placement handle.
/// </param>
/// <param name="extraParams">
/// The extrusion creation data.
/// </param>
/// <param name="setter">
/// The IFCPlacementSetter.
/// </param>
/// <param name="productWrapper">
/// The IFCProductWrapper.
/// </param>
public static void Export(ExporterIFC exporterIFC, Mullion mullion, GeometryElement geometryElement,
IFCAnyHandle localPlacement, IFCExtrusionCreationData extraParams, IFCPlacementSetter setter, IFCProductWrapper productWrapper)
{
IFCFile file = exporterIFC.GetFile();
ElementId catId = CategoryUtil.GetSafeCategoryId(mullion);
IFCSolidMeshGeometryInfo solidMeshInfo = ExporterIFCUtils.GetSolidMeshGeometry(exporterIFC, geometryElement, Transform.Identity);
IList<Solid> solids = solidMeshInfo.GetSolids();
IList<Mesh> polyMeshes = solidMeshInfo.GetMeshes();
bool tryToExportAsExtrusion = true;
if (solids.Count != 1 || polyMeshes.Count != 0)
tryToExportAsExtrusion = false;
IFCAnyHandle shapeRep = BodyExporter.ExportBody(mullion.Document.Application, exporterIFC, catId, solids, polyMeshes, tryToExportAsExtrusion, extraParams);
IList<IFCAnyHandle> shapeReps = new List<IFCAnyHandle>();
shapeReps.Add(shapeRep);
IFCAnyHandle repHnd = file.CreateProductDefinitionShape(IFCLabel.Create(), IFCLabel.Create(), shapeReps);
IFCLabel elemGUID = IFCLabel.CreateGUID(mullion);
IFCAnyHandle ownerHistory = exporterIFC.GetOwnerHistoryHandle();
IFCLabel elemObjectType = NamingUtil.CreateIFCObjectName(exporterIFC, mullion);
IFCLabel elemId = NamingUtil.CreateIFCElementId(mullion);
//IFCLabel elemType = IFCLabel.Create("MULLION");
IFCAnyHandle mullionHnd = file.CreateMember(elemGUID, ownerHistory, elemObjectType, IFCLabel.Create(), elemObjectType,
localPlacement, repHnd, elemId);
productWrapper.AddElement(mullionHnd, setter, extraParams, true);
}
示例11: GetPredefinedType
/// <summary>
/// Gets the predefined type from the IfcObject, depending on the file version and entity type.
/// </summary>
/// <param name="ifcElementAssembly">The associated handle.</param>
/// <returns>The predefined type, if any.</returns>
protected override string GetPredefinedType(IFCAnyHandle ifcElementAssembly)
{
IFCElementAssemblyType predefinedType =
IFCEnums.GetSafeEnumerationAttribute<IFCElementAssemblyType>(ifcElementAssembly, "PredefinedType", IFCElementAssemblyType.NotDefined);
return predefinedType.ToString();
}
示例12: ProcessIFCCartesianPointInternal
// This routine does no validity checking on the point, but does on attributes.
private static XYZ ProcessIFCCartesianPointInternal(IFCAnyHandle point, IFCPointType expectedCoordinates)
{
IList<double> coordinates = IFCAnyHandleUtil.GetCoordinates(point);
int numCoordinates = coordinates.Count;
if (numCoordinates < 2)
{
//LOG: Warning: Expected at least 2 coordinates for IfcCartesianPoint, found {numCoordinates}.
}
else if (numCoordinates > 3)
{
//LOG: Warning: Expected at most 3 coordinates for IfcCartesianPoint, found {numCoordinates}.
}
if (expectedCoordinates != IFCPointType.DontCare)
{
if ((expectedCoordinates == IFCPointType.UVPoint) && (numCoordinates != 2))
{
//LOG: Warning: Expected 2 coordinates for IfcCartesianPoint, found {numCoordinates}.
if (numCoordinates > 2)
numCoordinates = 2;
}
else if ((expectedCoordinates == IFCPointType.XYZPoint) && (numCoordinates != 3))
{
//LOG: Warning: Expected 3 coordinates for IfcCartesianPoint, found {numCoordinates}.
if (numCoordinates > 3)
numCoordinates = 3;
}
}
return ListToXYZ(coordinates);
}
示例13: ProcessIFCProperty
/// <summary>
/// Processes an IFC property.
/// </summary>
/// <param name="ifcProperty">The property.</param>
/// <returns>The IFCProperty object.</returns>
public static IFCProperty ProcessIFCProperty(IFCAnyHandle ifcProperty)
{
if (IFCAnyHandleUtil.IsNullOrHasNoValue(ifcProperty))
{
IFCImportFile.TheLog.LogNullError(IFCEntityType.IfcProperty);
return null;
}
try
{
IFCEntity property;
if (IFCImportFile.TheFile.EntityMap.TryGetValue(ifcProperty.StepId, out property))
return (property as IFCProperty);
if (IFCAnyHandleUtil.IsSubTypeOf(ifcProperty, IFCEntityType.IfcComplexProperty))
return IFCComplexProperty.ProcessIFCComplexProperty(ifcProperty);
if (IFCAnyHandleUtil.IsSubTypeOf(ifcProperty, IFCEntityType.IfcSimpleProperty))
return IFCSimpleProperty.ProcessIFCSimpleProperty(ifcProperty);
}
catch (Exception ex)
{
IFCImportFile.TheLog.LogError(ifcProperty.StepId, ex.Message, false);
return null;
}
IFCImportFile.TheLog.LogUnhandledSubTypeError(ifcProperty, IFCEntityType.IfcProperty, false);
return null;
}
示例14: Process
/// <summary>
/// Processes IfcSite attributes.
/// </summary>
/// <param name="ifcIFCSite">The IfcSite handle.</param>
protected override void Process(IFCAnyHandle ifcIFCSite)
{
base.Process(ifcIFCSite);
RefElevation = IFCImportHandleUtil.GetOptionalScaledLengthAttribute(ifcIFCSite, "RefElevation", 0.0);
IList<int> refLatitudeList = IFCAnyHandleUtil.GetAggregateIntAttribute<List<int>>(ifcIFCSite, "RefLatitude");
IList<int> refLongitudeList = IFCAnyHandleUtil.GetAggregateIntAttribute<List<int>>(ifcIFCSite, "RefLongitude");
if (refLatitudeList != null)
{
m_RefLatitude = 0.0;
double latLongScaler = 1.0;
foreach (double latVal in refLatitudeList)
{
m_RefLatitude += ((double)latVal) / latLongScaler;
latLongScaler *= 60.0;
}
}
if (refLongitudeList != null)
{
m_RefLongitude = 0.0;
double latLongScaler = 1.0;
foreach (double longVal in refLongitudeList)
{
m_RefLongitude += ((double)longVal) / latLongScaler;
latLongScaler *= 60.0;
}
}
m_LandTitleNumber = IFCAnyHandleUtil.GetStringAttribute(ifcIFCSite, "LandTitleNumber");
}
示例15: Process
/// <summary>
/// Processes IfcOpeningElement attributes.
/// </summary>
/// <param name="ifcOpeningElement">The IfcOpeningElement handle.</param>
protected override void Process(IFCAnyHandle ifcOpeningElement)
{
base.Process(ifcOpeningElement);
ICollection<IFCAnyHandle> hasFillings = IFCAnyHandleUtil.GetAggregateInstanceAttribute<List<IFCAnyHandle>>(ifcOpeningElement, "HasFillings");
if (hasFillings != null)
{
// Assume that there is only one filling for the opening, and take first found.
foreach (IFCAnyHandle hasFilling in hasFillings)
{
IFCAnyHandle relatedFillingElement = IFCAnyHandleUtil.GetInstanceAttribute(hasFilling, "RelatedBuildingElement");
if (IFCAnyHandleUtil.IsNullOrHasNoValue(relatedFillingElement))
continue;
IFCEntity filledByElement;
IFCImportFile.TheFile.EntityMap.TryGetValue(relatedFillingElement.StepId, out filledByElement);
if (filledByElement == null)
FilledByElement = IFCElement.ProcessIFCElement(relatedFillingElement);
else
FilledByElement = filledByElement as IFCElement;
FilledByElement.FillsOpening = this;
break;
}
}
}