本文整理汇总了C#中Point3d.GetAsVector方法的典型用法代码示例。如果您正苦于以下问题:C# Point3d.GetAsVector方法的具体用法?C# Point3d.GetAsVector怎么用?C# Point3d.GetAsVector使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Point3d
的用法示例。
在下文中一共展示了Point3d.GetAsVector方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: matchingPlans
private Dictionary<string, PanelBase> matchingPlans(List<FacadeMounting> facadesMounting, List<FloorArchitect> floorsAr)
{
// Определение окон в монтажных планах по архитектурным планам
var panelsBase = new Dictionary<string, PanelBase>(); // string - ключ - маркаСБ + Марки Окон по порядку.
// Список монтажных планов - уникальных
var floorsMount = facadesMounting.SelectMany(f => f.Floors);
foreach (var floorMount in floorsMount)
{
// Найти соотв арх план
var floorAr = floorsAr.Find(f =>
f.Section == floorMount.Section &&
f.IsEqualMountingStorey(floorMount.Storey)
);
//Test Добавить текст имени плана Ар в блок монтажного плана
#if Test
{
if (floorAr != null)
{
using (var btrMount = floorMount.IdBtrMounting.Open(OpenMode.ForWrite) as BlockTableRecord)
{
DBText textFindPlanAr = new DBText();
textFindPlanAr.TextString = floorAr.BlName;
btrMount.AppendEntity(textFindPlanAr);
//btrMount.Database.TransactionManager.TopTransaction.AddNewlyCreatedDBObject(textFindPlanAr, true);
}
}
}
#endif
if (floorAr == null)
{
Inspector.AddError($"Не найден блок архитектурного плана для соответствующего монтажного плана '{floorMount.BlRefName}'",
floorMount.IdBlRefMounting,
icon: System.Drawing.SystemIcons.Error);
}
else if (floorAr.Windows.Count == 0)
{
Inspector.AddError($"Не найдено ни одного окна в блоке архитектурного плана '{floorMount.BlRefName}'.",
floorAr.IdBlRef,
icon: System.Drawing.SystemIcons.Error);
}
foreach (var panelMount in floorMount.PanelsSbInFront)
{
Panel panelXml = GetPanelXml(panelMount.MarkSb, panelMount);
if (panelXml == null) continue;
PanelBase panelBase = new PanelBase(panelXml, this, panelMount);
// Определение окон в панели по арх плану
if (panelXml.windows?.window != null)
{
foreach (var window in panelXml.windows.window)
{
if (floorAr == null || floorAr.Windows.Count==0)
{
break;
}
// Точка окна внутри панели по XML описанию
Point3d ptOpeningCenter = new Point3d(window.posi.X + window.width * 0.5, 0, 0);
// Точка окна внутри монтажного плана
Point3d ptWindInModel = panelMount.ExtTransToModel.MinPoint.Add(ptOpeningCenter.GetAsVector());
Point3d ptWindInArPlan = ptWindInModel.TransformBy(floorMount.Transform.Inverse());
var windowKey = floorAr?.Windows.GroupBy(w => w.Key.DistanceTo(ptWindInArPlan))?.MinBy(w => w.Key);
if (windowKey == null || windowKey.Key > 600)
{
Inspector.AddError(
$"Не найдено соответствующее окно в архитектурном плане. Блок монтажной панели {panelMount.MarkSb}",
panelMount.ExtTransToModel, panelMount.IdBlRef, icon: System.Drawing.SystemIcons.Error);
continue;
}
panelBase.WindowsBaseCenters.Add(ptOpeningCenter, windowKey.First().Value);
// Test Добавление точек окна в блоке монтажки
#if Test
{
using (var btrMountPlan = floorMount.IdBtrMounting.Open(OpenMode.ForWrite) as BlockTableRecord)
{
using (DBPoint ptWinInPlan = new DBPoint(ptWindInArPlan))
{
ptWinInPlan.ColorIndex = 2;
btrMountPlan.AppendEntity(ptWinInPlan);
//btrMountPlan.Database.TransactionManager.TopTransaction.AddNewlyCreatedDBObject(ptWinInPlan, true);
}
using (DBText dbText = new DBText())
{
dbText.Position = ptWindInArPlan;
dbText.TextString = windowKey.First().Value;
btrMountPlan.AppendEntity(dbText);
//btrMountPlan.Database.TransactionManager.TopTransaction.AddNewlyCreatedDBObject(dbText, true);
}
}
using (var btrArPlan = floorAr.IdBtr.Open(OpenMode.ForWrite) as BlockTableRecord)
{
using (DBPoint ptWinInArPlan = new DBPoint(ptWindInArPlan))
//.........这里部分代码省略.........
示例2: CreateExtrusion
public static ObjectId CreateExtrusion(Point2d[] pts, Point3d destPt, Vector3d normal, WoodGrainAlignment grain)
{
ObjectId entId = ObjectId.Null;
Document activeDoc = Autodesk.AutoCAD.ApplicationServices.Core.Application.DocumentManager.MdiActiveDocument;
Database db = activeDoc.Database;
using (Transaction tr = db.TransactionManager.StartTransaction())
{
BlockTable bt = tr.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable;
BlockTableRecord btr = null;
if (String.IsNullOrEmpty(blockName))
btr = tr.GetObject(db.CurrentSpaceId, OpenMode.ForWrite) as BlockTableRecord;
else
{
if (bt.Has(blockName))
btr = tr.GetObject(bt[blockName], OpenMode.ForWrite) as BlockTableRecord;
else
{
btr = new BlockTableRecord();
btr.Name = blockName;
bt.UpgradeOpen();
bt.Add(btr);
tr.AddNewlyCreatedDBObject(btr, true);
}
}
Solid3d extrudedSolid = new Solid3d();
using (Autodesk.AutoCAD.DatabaseServices.Polyline outline = new Autodesk.AutoCAD.DatabaseServices.Polyline())
{
outline.SetDatabaseDefaults();
outline.Normal = normal;
int cnt = 0;
foreach (Point2d pt in pts)
{
outline.AddVertexAt(cnt, pt, 0, 0, 0);
cnt++;
}
outline.Closed = true;
Extents3d exts = outline.GeometricExtents;
Point3d minPt = exts.MinPoint;
Point3d maxPt = exts.MaxPoint;
double p1 = maxPt.X - minPt.X;
double p2 = maxPt.Y - minPt.Y;
double p3 = maxPt.Z - minPt.Z;
double pmin = 0.0;
if (p1 == 0)
{
pmin = Math.Min(p2, p3);
}
if (p2 == 0)
{
pmin = Math.Min(p1, p3);
}
if (p3 == 0)
{
pmin = Math.Min(p1, p2);
}
double pmax = Math.Max(Math.Max(p1, p2), p3);
extrudedSolid.RecordHistory = true;
plyIndex++;
Vector3d heightVector = outline.Normal * t;
SweepOptions sweepOptions = new SweepOptions();
SweepOptionsBuilder builder = new SweepOptionsBuilder(sweepOptions);
extrudedSolid.CreateExtrudedSolid(outline, heightVector, sweepOptions);
}
entId = btr.AppendEntity(extrudedSolid);
tr.AddNewlyCreatedDBObject(extrudedSolid, true);
extrudedSolid.TransformBy(Matrix3d.Displacement(destPt.GetAsVector()));
tr.Commit();
}
return entId;
}