本文整理汇总了C#中IFCFile.CreateInstance方法的典型用法代码示例。如果您正苦于以下问题:C# IFCFile.CreateInstance方法的具体用法?C# IFCFile.CreateInstance怎么用?C# IFCFile.CreateInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IFCFile
的用法示例。
在下文中一共展示了IFCFile.CreateInstance方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateSweptDiskSolid
/// <summary>
/// Creates a handle representing an IfcSweptDiskSolid and assigns it to the file.
/// </summary>
/// <param name="file">The file.</param>
/// <param name="directrix">The curve used to define the sweeping operation.</param>
/// <param name="radius">The radius of the circular disk to be swept along the directrix.</param>
/// <param name="innerRadius">This attribute is optional, if present it defines the radius of a circular hole in the centre of the disk.</param>
/// <param name="startParam">The parameter value on the directrix at which the sweeping operation commences.</param>
/// <param name="endParam">The parameter value on the directrix at which the sweeping operation ends.</param>
/// <returns>The handle.</returns>
public static IFCAnyHandle CreateSweptDiskSolid(IFCFile file, IFCAnyHandle directrix, double radius,
double? innerRadius, double startParam, double endParam)
{
IFCAnyHandleUtil.ValidateSubTypeOf(directrix, false, IFCEntityType.IfcCurve);
IFCAnyHandle sweptDiskSolid = file.CreateInstance(IFCEntityType.IfcSweptDiskSolid.ToString());
IFCAnyHandleUtil.SetAttribute(sweptDiskSolid, "Directrix", directrix);
IFCAnyHandleUtil.SetAttribute(sweptDiskSolid, "Radius", radius);
IFCAnyHandleUtil.SetAttribute(sweptDiskSolid, "InnerRadius", innerRadius);
IFCAnyHandleUtil.SetAttribute(sweptDiskSolid, "StartParam", startParam);
IFCAnyHandleUtil.SetAttribute(sweptDiskSolid, "EndParam", endParam);
return sweptDiskSolid;
}
示例2: CreateInstance
/////////////////////////////////////////////////////////////////
// SetXXX method is to set base entities' attributes.
// Every SetXXX method has a corresponding ValidateXXX method.
// ValidateXXX is to validate the parameters for the attributes.
// ValidateXXX should not be called in SetXXX. It must be called in CreateXXX method.
// This is to make sure all arguments are valid BEFORE create an instance.
// So we have below layout for these methods:
// ValidateABCBaseEntity(...) { ... }
// SetABCBaseEntity(...) { ... }
// CreateABCEntity(...)
// {
// //Code to validate ABC entity's own parameters goes here.
// ValidateABCBaseEntity(...);
// //Code to create ABC instance goes here.
// //Code to set ABC entity's own attributes goes here.
// SetABCBaseEntity(...);
// }
///////////////////////////////////////////////////////////////
private static IFCAnyHandle CreateInstance(IFCFile file, IFCEntityType type)
{
IFCAnyHandle hnd = file.CreateInstance(type.ToString());
ExporterCacheManager.HandleTypeCache[hnd] = type;
return hnd;
}