如何在revit中找到斜坡的开始/结束,也许是草图? [英] How to find start/end of ramp in revit, perhaps with sketches?

查看:25
本文介绍了如何在revit中找到斜坡的开始/结束,也许是草图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一堆斜坡,我想知道它们的起点和终点(如果有多个起点/终点,我想知道它们是如何连接的).我目前将这些作为

I have a bunch of ramps that I would like to know the begin and end points of (and in case of multiple begin/end points I would like to know how they connect). I currently get these as

List<TransitionPoint> ret = new List<TransitionPoint>();
FilteredElementCollector collector = new FilteredElementCollector(doc);
ICollection<Element> ramps = collector.OfCategory(BuiltInCategory.OST_Ramps).ToElements();

foreach (var ramp in ramps)
{
   //what goes here?
}

这些斜坡包含以下属性:

These ramps contain the following properties:

Type Comments
Ramp Max Slope (1/x)
Category
URL
Design Option
Type Name
Ramp Material
Function
Manufacturer
Family Name
Model
Keynote
Type Image
Text Size
Shape
Text Font
Maximum Incline Length
Assembly Description
Assembly Code
Type Mark
Category
Thickness
Cost
Description

现在,如果这些楼梯我会使用 ICollection stairs = collector.OfCategory(BuiltInCategory.OST_Stairs).OfClass(typeof(Stairs)).ToElements();然后我可以将对象转换为 Stairs 但是似乎没有一个类 simmulair to Stairs 这将允许我处理 Stairs.GetStairsRuns().

Now if these where stairs I would use ICollection stairs = collector.OfCategory(BuiltInCategory.OST_Stairs).OfClass(typeof(Stairs)).ToElements(); and then I can cast the objects into Stairs however there does not appear to be a class simmulair to Stairs which would allow me to adres Stairs.GetStairsRuns().

有人知道如何获得 RampRun 之类的东西或以其他方式找到坡道的起点和终点吗?

Anybody know how to either get something like a RampRun or otherwise find the start and end of a ramp?

我也尝试了以下解决方案,但也没有用

I have also tried the following sollution but that didn't work either

public static void MapRunsToRamps(Document doc)
{
   var rule = ParameterFilterRuleFactory.CreateNotEqualsRule(new ElementId(BuiltInParameter.HOST_ID_PARAM), "null", true);

   ElementParameterFilter filter = new ElementParameterFilter(rule);
   FilteredElementCollector collector = new FilteredElementCollector(doc);
   List<Element> rampsRuns = collector.WherePasses(filter).ToElements().ToList<Element>();
   foreach (Element e in rampsRuns)
   {
      var hostpara = e.get_Parameter(BuiltInParameter.HOST_ID_PARAM);
      if (hostpara != null)
      {
         var host = doc.GetElement(new ElementId(hostpara.AsInteger()));
         if (host.Category.Equals(BuiltInCategory.OST_Ramps))
         {
            //breakpoint that is never activated 
         }
      }
   }
}

这会发现很多物体都没有斜坡作为宿主.

This finds plenty of objects just none with a ramp as a host.

这是一个坡道示例,我试图找到用红色箭头标记的位置.

Here is an example of a ramp and the location I'm trying to find marked with red arrows.

这个 https://forums.autodesk.com/t5/revit-api/how-do-we-get-the-xyz-cordinates-for-stairs-ramps/td-p/2575349 建议我们可以使用位置曲线,有什么办法吗?

this https://forums.autodesk.com/t5/revit-api/how-do-we-get-the-x-y-z-cordinates-for-stairs-ramps/td-p/2575349 suggests that we can use a locationcurve, any way to do that?

似乎确实有草图,我们可以根据这些草图找到坡道,问题是我是否有草图说

edit: There do appear to be sketches based on which we might be able to find the ramps, question is if I have a sketch say with

    var rampCategoryfilter = new ElementCategoryFilter(BuiltInCategory.OST_StairsSketchRunLines);
    var rampsRuns = new FilteredElementCollector(doc).WherePasses(rampCategoryfilter);

那么我确实可以找到位置,但我没有的是它也属于的坡道,知道如何找到它吗?

then I can indeed get the locations but what I do not have is the ramp that this belongs too, any idea how to find that?

推荐答案

假设你的 Ramp 是一个 FamilyInstance :

Assuming that your Ramp is a FamilyInstance :

var fecRamps = new FilteredElementCollector(doc)
    .OfClass(typeof(FamilyInstance))
    .Where(pElt =>
    {
        int lCatId = pElt.Category.Id.IntegerValue;
        return lCatId == (int)BuiltInCategory.OST_Ramps;
    })
    .OfType<FamilyInstance>()
    .ToList();

List<XYZ> lRampLocs = new List<XYZ>();
foreach (var pFam in fecRamps)
{
    var fLoc = pFam.Location as LocationCurve;
    var fRampSide1 = new XYZ(fLoc.Curve.GetEndPoint(0);
    var fRampSide2 = new XYZ(fLoc.Curve.GetEndPoint(1);

    lRampLocs.Add(fRampSide1);
    lRampLocs.Add(fRampSide2);
}

每个FamilyInstance 都有一个Location,您可以将Location 转换为LocationCurve.从曲线中,您可以通过 Autodesk.Revit.DB 命名空间获得端点.

Every FamilyInstance has a Location and you can cast the Location as a LocationCurve. From the curve, you can get the end points via the Autodesk.Revit.DB namespace.

这篇关于如何在revit中找到斜坡的开始/结束,也许是草图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆