惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

K
Kaspersky official blog
Engineering at Meta
Engineering at Meta
D
DataBreaches.Net
Stack Overflow Blog
Stack Overflow Blog
Microsoft Security Blog
Microsoft Security Blog
Y
Y Combinator Blog
B
Blog RSS Feed
GbyAI
GbyAI
P
Proofpoint News Feed
aimingoo的专栏
aimingoo的专栏
MyScale Blog
MyScale Blog
D
Docker
阮一峰的网络日志
阮一峰的网络日志
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Recorded Future
Recorded Future
美团技术团队
The Register - Security
The Register - Security
V
Visual Studio Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
T
Tailwind CSS Blog
爱范儿
爱范儿
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
T
The Blog of Author Tim Ferriss
博客园 - 司徒正美
量子位
B
Blog
F
Fortinet All Blogs
Martin Fowler
Martin Fowler
博客园 - 【当耐特】
MongoDB | Blog
MongoDB | Blog
A
About on SuperTechFans
I
InfoQ
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
有赞技术团队
有赞技术团队
雷峰网
雷峰网
大猫的无限游戏
大猫的无限游戏
J
Java Code Geeks
L
LangChain Blog
Latest news
Latest news
S
SegmentFault 最新的问题
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Blog — PlanetScale
Blog — PlanetScale
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Cisco Talos Blog
Cisco Talos Blog
F
Full Disclosure
C
Cisco Blogs
D
Darknet – Hacking Tools, Hacker News & Cyber Security
W
WeLiveSecurity
T
Tenable Blog
T
Tor Project blog

博客园 - Albert_MIN

在 ASP.NET Core MVC 中,接收数据的几种方式 Content-Type 对应不同的前端数据结构与构造方式 Revit二次开发 钢筋生成API(二) Revit二次开发 钢筋生成API(一) revit二次开发 钢筋布置方式 revit二次开发之 钢筋功能详细分析 revit 二次开发之收集器、过滤器和选择器 Revit Server的注意要配置说明 WCF文件配置服务 WCF服务的各种绑定 Revit二次开发之 对象的隐藏与显示 Revit二次开发之 GeometryObject分析 Revit二次开发之 Material 分析 Revit二次开发之 PolymeshTopology Revit 二次开发之 图纸的导出 Revit开发之 IExportContext接口详细 JavaScript 困惑之 ArrayBuffer JS 困惑之this的指向 Revit二次开发之 族的创建 Revit二次开发 钢筋生成 Revit二次开发之 尺寸标线
Revit二次开发之 尺寸标线(二)
Albert_MIN · 2022-08-12 · via 博客园 - Albert_MIN

一、云标记

云注释的作用,主要是用于图纸修订提示使用的,所有云注释的核心要基于一个修订,其基本逻辑如下:

创建一个修订

private Revision AddNewRevision(Document document, string description, string issuedBy, string issuedTo, int sequenceNumber, DateTime date)
{
    Revision newRevision = Revision.Create(document);
    newRevision.Description = description;
    newRevision.IssuedBy = issuedBy;
    newRevision.IssuedTo = issuedTo;
    newRevision.NumberType = RevisionNumberType.Alphanumeric;
    newRevision.RevisionDate = date.ToShortDateString();
    return newRevision;
}

根据修订,创建一个云标记

private void CreateRevisionCloudInActiveView(Document document, Revision revision, IList<Curve> curves)
{
    using (Transaction newRevisionCloud = new Transaction(document, "Create Revision Cloud"))
    {
        newRevisionCloud.Start();
        // Can only create revision cloud for revision that is not issued
        if (revision.Issued == false)
        {
            RevisionCloud.Create(document, document.ActiveView, revision.Id, curves);
            newRevisionCloud.Commit();
        }
        else
        {
            newRevisionCloud.RollBack();
        }
    }
}

二、隔热层

隔热层其实是详图线的一种类别,其创建方法和详图线一样,可以设置图形样式和类别,实现隔热层显示

  private static void createDetailLine(Document doc, XYZ endpoint, XYZ startpoint, GraphicsStyle gs, out DetailLine modeline)
        {
            Transaction trans = new Transaction(doc);
            trans.Start("creatDetailLine");
            //DetailLine line = locationCurve.Curve as DetailLine;
            Line line = Line.CreateBound(startpoint, endpoint);
            modeline = doc.Create.NewDetailCurve(doc.ActiveView, line) as DetailLine;
            Parameter tp = modeline.LookupParameter("线样式");
            tp.Set(gs.Id);
            trans.Commit();
        }

三、标记

实现对指定的类别进行标记,在revit操作中分为类别标记和全部标记,其使用的对象是一样的,只是批量操作的功能区别,最终是创建与元素关联的IndependentTag 对象,包按类别标记、全部标记、多类别标记、材质标记和空间标记等

private IndependentTag CreateIndependentTag(Autodesk.Revit.DB.Document document, Wall wall)
{
    // make sure active view is not a 3D view
    Autodesk.Revit.DB.View view = document.ActiveView;

    // define tag mode and tag orientation for new tag
    TagMode tagMode = TagMode.TM_ADDBY_CATEGORY;
    TagOrientation tagorn = TagOrientation.Horizontal;

    // Add the tag to the middle of the wall
    LocationCurve wallLoc = wall.Location as LocationCurve;
    XYZ wallStart = wallLoc.Curve.GetEndPoint(0);
    XYZ wallEnd = wallLoc.Curve.GetEndPoint(1);
    XYZ wallMid = wallLoc.Curve.Evaluate(0.5, true);
    Reference wallRef = new Reference(wall);

    IndependentTag newTag = IndependentTag.Create(document, view.Id,  wallRef, true, tagMode, tagorn, wallMid);
    if (null == newTag)
    {
        throw new Exception("Create IndependentTag Failed.");
    }

    // newTag.TagText is read-only, so we change the Type Mark type parameter to 
    // set the tag text.  The label parameter for the tag family determines
    // what type parameter is used for the tag text.

    WallType type = wall.WallType;

    Parameter foundParameter = type.LookupParameter("Type Mark");
    bool result = foundParameter.Set("Hello");

    // set leader mode free
    // otherwise leader end point move with elbow point

    newTag.LeaderEndCondition = LeaderEndCondition.Free;
    XYZ elbowPnt = wallMid + new XYZ(5.0, 5.0, 0.0);
    newTag.LeaderElbow = elbowPnt;
    XYZ headerPnt = wallMid + new XYZ(10.0, 10.0, 0.0);
    newTag.TagHeadPosition = headerPnt;

    return newTag;
}