美文网首页
PortType 的理解

PortType 的理解

作者: 饭桶2018 | 来源:发表于2022-11-18 11:31 被阅读0次
    image.png image.png

    static 为数据库定义的点
    dynamic 为比如在pipe上创建支架后动态生成的2个port
    symbolic 暂时还未碰到

    public enum PortType
    {
        Static = 1,
        Dynamic = 2,
        Both = 3,
        Symbolic = 4,
        All = 7
    }
    
    var doc = Application.DocumentManager.MdiActiveDocument;
    var ed = doc.Editor;
    var db = doc.Database;
    using (var tr = db.TransactionManager.StartOpenCloseTransaction())
    {
        var select = ed.GetSelection();
        if (select.Status != PromptStatus.OK) return;
        foreach (SelectedObject sel in select.Value)
        {
            var ent = tr.GetObject(sel.ObjectId, OpenMode.ForRead);
            Console.WriteLine($"{ent}");
    
            if (ent is Autodesk.ProcessPower.PnP3dObjects.Part part)
            {
                foreach (Autodesk.ProcessPower.PnP3dObjects.Port p in part.GetPorts(PortType.All))
                {
                    Console.WriteLine($"\t{p.Name} {p.Position} {p.Direction} {p.NominalDiameter}");
                }
            } 
        }
    
    }
    
    Autodesk.ProcessPower.PnP3dObjects.Pipe
        S1 (8845,-10763.999999989,4714.15000062592) (0,4.60102066332199E-12,-1) 0in
        S2 (8845,-10764,7104.799756) (0,-4.60102066332199E-12,1) 0in
    Autodesk.ProcessPower.PnP3dObjects.Connector
        S1 (8997.39999998712,-10764,7257.199756) (0.999999999999897,4.55167751525286E-07,-1.25184798973133E-11) 0in
        S2 (8997.39999998712,-10764,7257.199756) (-1,0,-8.4515888561855E-11) 0in
    Autodesk.ProcessPower.PnP3dObjects.Connector
        S1 (8845,-10764,7104.799756) (0,0,-1) 0in
        S2 (8845,-10764,7104.799756) (0,0,1) 0in
    Autodesk.ProcessPower.PnP3dObjects.Support
        S1 (9850,-10764,7257.19975598712) (-0.999999999999896,-4.55167751525286E-07,1.25184798973133E-11) 0in
    Autodesk.ProcessPower.PnP3dObjects.Support
        S1 (9850,-10764,7257.19975598712) (-0.999999999999896,-4.55167751525286E-07,1.25184798973133E-11) 0in
    Autodesk.ProcessPower.PnP3dObjects.Pipe
        S1 (8997.39999998712,-10764,7257.199756) (-0.999999999999896,-4.55167751525286E-07,1.25184798973133E-11) 0in
        S2 (10026.3,-10763.9995316779,7257.19975598712) (0.999999999999896,4.55167751525286E-07,-1.25184798973133E-11) 0in
        D1 (9850,-10764,7257.19975598712) (0.999999999999897,4.55167751525286E-07,-1.25184798973133E-11) 0in
        D2 (9850,-10764,7257.19975598712) (0.999999999999897,4.55167751525286E-07,-1.25184798973133E-11) 0in
    Autodesk.ProcessPower.PnP3dObjects.PipeInlineAsset
        S1 (8845,-10764,7104.799756) (0,0,-1) 0in
        S2 (8997.39999998712,-10764,7257.199756) (1,0,8.4515888561855E-11) 0in
    
    

    相关文章

      网友评论

          本文标题:PortType 的理解

          本文链接:https://www.haomeiwen.com/subject/ephpxdtx.html