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

推荐订阅源

钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
云风的 BLOG
云风的 BLOG
IT之家
IT之家
C
Check Point Blog
T
The Blog of Author Tim Ferriss
S
SegmentFault 最新的问题
人人都是产品经理
人人都是产品经理
H
Hackread – Cybersecurity News, Data Breaches, AI and More
美团技术团队
M
MIT News - Artificial intelligence
Jina AI
Jina AI
Blog — PlanetScale
Blog — PlanetScale
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Microsoft Security Blog
Microsoft Security Blog
G
Google Developers Blog
F
Fortinet All Blogs
V
Visual Studio Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
T
Tailwind CSS Blog
Hugging Face - Blog
Hugging Face - Blog
MyScale Blog
MyScale Blog
爱范儿
爱范儿
The Cloudflare Blog
博客园 - 三生石上(FineUI控件)

博客园 - Albert_MIN

在 ASP.NET Core 中创建中间件的五种方式 在 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;
}