本文整理汇总了C#中Transform.get_Basis方法的典型用法代码示例。如果您正苦于以下问题:C# Transform.get_Basis方法的具体用法?C# Transform.get_Basis怎么用?C# Transform.get_Basis使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Transform
的用法示例。
在下文中一共展示了Transform.get_Basis方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TransformPoint
public static XYZ TransformPoint(XYZ point, Transform transform)
{
double x = point.X;
double y = point.Y;
double z = point.Z;
//transform basis of the old coordinate system in the new coordinate // system
XYZ b0 = transform.get_Basis(0);
XYZ b1 = transform.get_Basis(1);
XYZ b2 = transform.get_Basis(2);
XYZ origin = transform.Origin;
//transform the origin of the old coordinate system in the new
//coordinate system
double xTemp = x * b0.X + y * b1.X + z * b2.X + origin.X;
double yTemp = x * b0.Y + y * b1.Y + z * b2.Y + origin.Y;
double zTemp = x * b0.Z + y * b1.Z + z * b2.Z + origin.Z;
return new XYZ(xTemp, yTemp, zTemp);
}
示例2: ExportFamilyInstanceAsMappedItem
//.........这里部分代码省略.........
bodyData = BodyExporter.ExportBody(familyInstance.Document.Application, exporterIFC, familyInstance, categoryId, ElementId.InvalidElementId,
geomObjects, bodyExporterOptions, extraParams);
typeInfo.MaterialIds = bodyData.MaterialIds;
}
else
{
IList<GeometryObject> exportedGeometries = new List<GeometryObject>();
exportedGeometries.Add(exportGeometry);
bodyData = BodyExporter.ExportBody(familyInstance.Document.Application, exporterIFC, familyInstance, categoryId, ElementId.InvalidElementId,
exportedGeometries, bodyExporterOptions, extraParams);
}
bodyRepresentation = bodyData.RepresentationHnd;
brepOffsetTransform = bodyData.BrepOffsetTransform;
}
if (IFCAnyHandleUtil.IsNullOrHasNoValue(bodyRepresentation))
{
extraParams.ClearOpenings();
return;
}
}
// By default: if exporting IFC2x3 or later, export 2D plan rep of family, if it exists, unless we are exporting Coordination View V2.
// This default can be overridden in the export options.
if (needToCreate2d)
{
XYZ curveOffset = new XYZ(0, 0, 0);
if (brepOffsetTransform != null)
curveOffset = -brepOffsetTransform.Origin / scale;
HashSet<IFCAnyHandle> curveSet = new HashSet<IFCAnyHandle>();
{
Transform planeTrf = doorWindowTrf.Inverse;
Plane plane = new Plane(planeTrf.get_Basis(0), planeTrf.get_Basis(1), planeTrf.Origin);
XYZ projDir = new XYZ(0, 0, 1);
IFCGeometryInfo IFCGeometryInfo = IFCGeometryInfo.CreateCurveGeometryInfo(exporterIFC, plane, projDir, true);
ExporterIFCUtils.CollectGeometryInfo(exporterIFC, IFCGeometryInfo, exportGeometry, curveOffset, false);
IList<IFCAnyHandle> curves = IFCGeometryInfo.GetCurves();
foreach (IFCAnyHandle curve in curves)
curveSet.Add(curve);
if (curveSet.Count > 0)
{
IFCAnyHandle contextOfItems2d = exporterIFC.Get2DContextHandle();
IFCAnyHandle curveRepresentationItem = IFCInstanceExporter.CreateGeometricSet(file, curveSet);
HashSet<IFCAnyHandle> bodyItems = new HashSet<IFCAnyHandle>();
bodyItems.Add(curveRepresentationItem);
planRepresentation = RepresentationUtil.CreateGeometricSetRep(exporterIFC, familyInstance, categoryId, "Annotation",
contextOfItems2d, bodyItems);
}
}
}
}
}
if (doorWindowInfo != null)
{
typeInfo.StyleTransform = doorWindowTrf.Inverse;
}
else
{
if (!MathUtil.IsAlmostZero(extraOffset.DotProduct(extraOffset)))
{
Transform newTransform = typeInfo.StyleTransform;
示例3: TransformPoint
/// <summary>
/// Transform old coordinate system in the new coordinate system
/// </summary>
/// <param name="point">the Autodesk.Revit.DB.XYZ which need to be transformed</param>
/// <param name="transform">the value of the coordinate system to be transformed</param>
/// <returns>the new Autodesk.Revit.DB.XYZ which has been transformed</returns>
public static Autodesk.Revit.DB.XYZ TransformPoint(Autodesk.Revit.DB.XYZ point, Transform transform)
{
//get the coordinate value in X, Y, Z axis
double x = point.X;
double y = point.Y;
double z = point.Z;
//transform basis of the old coordinate system in the new coordinate system
Autodesk.Revit.DB.XYZ b0 = transform.get_Basis(0);
Autodesk.Revit.DB.XYZ b1 = transform.get_Basis(1);
Autodesk.Revit.DB.XYZ b2 = transform.get_Basis(2);
Autodesk.Revit.DB.XYZ origin = transform.Origin;
//transform the origin of the old coordinate system in the new coordinate system
double xTemp = x * b0.X + y * b1.X + z * b2.X + origin.X;
double yTemp = x * b0.Y + y * b1.Y + z * b2.Y + origin.Y;
double zTemp = x * b0.Z + y * b1.Z + z * b2.Z + origin.Z;
return new Autodesk.Revit.DB.XYZ (xTemp, yTemp, zTemp);
}
示例4: AddTransform
/// <summary>
/// Add 2 Transform Matrix
/// </summary>
/// <param name="tran1"></param>
/// <param name="tran2"></param>
/// <returns></returns>
private Transform AddTransform(Transform tran1, Transform tran2)
{
Autodesk.Revit.DB.XYZ xyz = new Autodesk.Revit.DB.XYZ (0, 0, 0);
Transform result = Transform.get_Translation(xyz);
result.Origin = MathUtil.AddXYZ(tran1.Origin, tran2.Origin);
Autodesk.Revit.DB.XYZ[] left = new Autodesk.Revit.DB.XYZ[3];
Autodesk.Revit.DB.XYZ[] right = new Autodesk.Revit.DB.XYZ[3];
for (int i = 0; i < 3; i++)
{
left[i] = tran1.get_Basis(i);
right[i] = tran2.get_Basis(i);
}
Autodesk.Revit.DB.XYZ[] temp = MathUtil.MultiCross(left, right);
for (int i = 0; i < 3; i++)
{
result.set_Basis(i, temp[i]);
}
return result;
}
示例5: ExportFamilyInstanceAsMappedItem
//.........这里部分代码省略.........
}
else
{
extraParams.PossibleExtrusionAxes = IFCExtrusionAxes.TryXYZ;
}
if (solids.Count > 0 || polyMeshes.Count > 0)
{
bodyRepresentation = BodyExporter.ExportBody(familyInstance.Document.Application, exporterIFC, categoryId, solids, polyMeshes,
tryToExportAsExtrusion, extraParams);
typeInfo.MaterialId = BodyExporter.GetBestMaterialIdForGeometry(solids, polyMeshes);
}
else
{
IList<GeometryObject> exportedGeometries = new List<GeometryObject>();
exportedGeometries.Add(exportGeometry);
bodyRepresentation = BodyExporter.ExportBody(familyInstance.Document.Application, exporterIFC, categoryId, exportedGeometries,
tryToExportAsExtrusion, extraParams);
}
if (!bodyRepresentation.HasValue)
{
extraParams.ClearOpenings();
return;
}
}
// if exporting IFC2x3 (or later), export 2D plan rep of family (if it exists).
if (needToCreate2d)
{
HashSet<IFCAnyHandle> curveSet = new HashSet<IFCAnyHandle>();
{
Transform planeTrf = doorWindowTrf.Inverse;
Plane plane = new Plane(planeTrf.get_Basis(0), planeTrf.get_Basis(1), planeTrf.Origin);
XYZ projDir = new XYZ(0, 0, 1);
IFCGeometryInfo IFCGeometryInfo = IFCGeometryInfo.CreateCurveGeometryInfo(exporterIFC, plane, projDir, true);
ExporterIFCUtils.CollectGeometryInfo(exporterIFC, IFCGeometryInfo, exportGeometry, planeTrf.Origin, false);
IList<IFCAnyHandle> curves = IFCGeometryInfo.GetCurves();
foreach (IFCAnyHandle curve in curves)
curveSet.Add(curve);
if (curveSet.Count > 0)
{
IFCAnyHandle contextOfItems2d = exporterIFC.Get2DContextHandle();
IFCAnyHandle curveRepresentationItem = file.CreateGeometricSet(curveSet);
HashSet<IFCAnyHandle> bodyItems = new HashSet<IFCAnyHandle>();
bodyItems.Add(curveRepresentationItem);
planRepresentation = RepresentationUtil.CreateGeometricSetRep(exporterIFC, categoryId, "Annotation",
contextOfItems2d, bodyItems);
}
}
}
}
}
if (doorWindowInfo != null)
{
typeInfo.SetStyleTransform(doorWindowTrf.Inverse);
}
else
{
if (!MathUtil.IsAlmostZero(extraOffset.DotProduct(extraOffset)))
{
Transform newTransform = typeInfo.GetStyleTransform();
示例6: ExportFamilyInstanceAsMappedItem
//.........这里部分代码省略.........
}
BodyData bodyData = null;
if (IFCAnyHandleUtil.IsNullOrHasNoValue(bodyRepresentation))
{
BodyExporterOptions bodyExporterOptions = new BodyExporterOptions(tryToExportAsExtrusion);
bodyData = BodyExporter.ExportBody(exporterIFC, familyInstance, categoryId, ElementId.InvalidElementId,
geomObjects, bodyExporterOptions, extraParams);
typeInfo.MaterialIds = bodyData.MaterialIds;
bodyRepresentation = bodyData.RepresentationHnd;
offsetTransform = bodyData.OffsetTransform;
}
// We will allow a door or window to be exported without any geometry, or an element with parts.
// Anything else doesn't really make sense.
if (IFCAnyHandleUtil.IsNullOrHasNoValue(bodyRepresentation) && (doorWindowInfo == null))
{
extraParams.ClearOpenings();
return;
}
}
// By default: if exporting IFC2x3 or later, export 2D plan rep of family, if it exists, unless we are exporting Coordination View V2.
// This default can be overridden in the export options.
if (needToCreate2d)
{
XYZ curveOffset = new XYZ(0, 0, 0);
if (offsetTransform != null)
curveOffset = -offsetTransform.Origin / scale;
HashSet<IFCAnyHandle> curveSet = new HashSet<IFCAnyHandle>();
{
Transform planeTrf = doorWindowTrf.Inverse;
Plane plane = new Plane(planeTrf.get_Basis(0), planeTrf.get_Basis(1), planeTrf.Origin);
XYZ projDir = new XYZ(0, 0, 1);
IFCGeometryInfo IFCGeometryInfo = IFCGeometryInfo.CreateCurveGeometryInfo(exporterIFC, plane, projDir, true);
ExporterIFCUtils.CollectGeometryInfo(exporterIFC, IFCGeometryInfo, exportGeometry, curveOffset, false);
IList<IFCAnyHandle> curves = IFCGeometryInfo.GetCurves();
foreach (IFCAnyHandle curve in curves)
curveSet.Add(curve);
if (curveSet.Count > 0)
{
IFCAnyHandle contextOfItems2d = exporterIFC.Get2DContextHandle();
IFCAnyHandle curveRepresentationItem = IFCInstanceExporter.CreateGeometricSet(file, curveSet);
HashSet<IFCAnyHandle> bodyItems = new HashSet<IFCAnyHandle>();
bodyItems.Add(curveRepresentationItem);
planRepresentation = RepresentationUtil.CreateGeometricSetRep(exporterIFC, familyInstance, categoryId, "FootPrint",
contextOfItems2d, bodyItems);
}
}
}
}
if (doorWindowInfo != null)
typeInfo.StyleTransform = doorWindowTrf.Inverse;
else
typeInfo.StyleTransform = ExporterIFCUtils.GetUnscaledTransform(exporterIFC, extraParams.GetLocalPlacement());
// for many
HashSet<IFCAnyHandle> propertySets = null;
IFCAnyHandle typeStyle = CreateFamilyTypeHandle(exporterIFC, typeInfo, doorWindowInfo, bodyRepresentation, planRepresentation,
familyInstance, familySymbol, originalFamilySymbol, useInstanceGeometry, exportParts,
exportType, revitObjectType, ifcEnumType, out propertySets);
示例7: GetBasis
/// <summary>
/// get the coordinates from old coordinate system in the new coordinate system
/// </summary>
/// <param name="point"></param>
/// <param name="transform"></param>
/// <returns></returns>
public static Autodesk.Revit.DB.XYZ GetBasis(Autodesk.Revit.DB.XYZ point, Transform transform)
{
double x = point.X;
double y = point.Y;
double z = point.Z;
double x2;
double y2;
double z2;
//transform basis of the old coordinate system in the new coordinate system
Autodesk.Revit.DB.XYZ b0 = transform.get_Basis(0);
Autodesk.Revit.DB.XYZ b1 = transform.get_Basis(1);
Autodesk.Revit.DB.XYZ b2 = transform.get_Basis(2);
Autodesk.Revit.DB.XYZ origin = transform.Origin;
//transform the origin of the old coordinate system in the new coordinate system
x2 = x * b0.X + y * b1.X + z * b2.X + origin.X;
y2 = x * b0.Y + y * b1.Y + z * b2.Y + origin.Y;
z2 = x * b0.Z + y * b1.Z + z * b2.Z + origin.Z;
Autodesk.Revit.DB.XYZ newPoint = new Autodesk.Revit.DB.XYZ (x2, y2, z2);
return newPoint;
}