public List <ApplicationPlaceholderObject> AnalyticalSurfaceToNative(Element2D speckleElement) { List <ApplicationPlaceholderObject> placeholderObjects = new List <ApplicationPlaceholderObject> { }; switch (speckleElement.property.type) { case Structural.PropertyType2D.Wall: Geometry.Line baseline = GetBottomLine(speckleElement.topology); double lowestElvevation = speckleElement.topology.Min(node => node.basePoint.z); double topElevation = speckleElement.topology.Max(node => node.basePoint.z); Node bottomNode = speckleElement.topology.Find(node => node.basePoint.z == lowestElvevation); Node topNode = speckleElement.topology.Find(node => node.basePoint.z == topElevation); var bottemLevel = LevelFromPoint(PointToNative(bottomNode.basePoint)); var topLevel = LevelFromPoint(PointToNative(topNode.basePoint)); RevitWall revitWall = new RevitWall(speckleElement.property.name, speckleElement.property.name, baseline, bottemLevel, topLevel); return(WallToNative(revitWall)); break; default: var polycurve = PolycurveFromTopology(speckleElement.topology); var level = LevelFromPoint(PointToNative(speckleElement.topology[0].basePoint)); RevitFloor revitFloor = new RevitFloor(speckleElement.property.name, speckleElement.property.name, polycurve, level); return(FloorToNative(revitFloor)); break; } return(placeholderObjects); }
public RevitWall WallToSpeckle(DB.Wall revitWall) { var baseGeometry = LocationToSpeckle(revitWall); if (baseGeometry is Geometry.Point) { ConversionErrors.Add(new Error { message = "Failed to convert wall by point. Currently not supported." }); return(null); } RevitWall speckleWall = new RevitWall(); speckleWall.family = revitWall.WallType.FamilyName.ToString(); speckleWall.type = revitWall.WallType.Name; speckleWall.baseLine = (ICurve)baseGeometry; speckleWall.level = ConvertAndCacheLevel(revitWall, BuiltInParameter.WALL_BASE_CONSTRAINT); speckleWall.topLevel = ConvertAndCacheLevel(revitWall, BuiltInParameter.WALL_HEIGHT_TYPE); speckleWall.height = GetParamValue <double>(revitWall, BuiltInParameter.WALL_USER_HEIGHT_PARAM); speckleWall.baseOffset = GetParamValue <double>(revitWall, BuiltInParameter.WALL_BASE_OFFSET); speckleWall.topOffset = GetParamValue <double>(revitWall, BuiltInParameter.WALL_TOP_OFFSET); speckleWall.structural = GetParamValue <bool>(revitWall, BuiltInParameter.WALL_STRUCTURAL_SIGNIFICANT); speckleWall.flipped = revitWall.Flipped; speckleWall["@displayMesh"] = GetWallDisplayMesh(revitWall); GetAllRevitParamsAndIds(speckleWall, revitWall, new List <string> { "WALL_USER_HEIGHT_PARAM", "WALL_BASE_OFFSET", "WALL_TOP_OFFSET", "WALL_BASE_CONSTRAINT", "WALL_HEIGHT_TYPE", "WALL_STRUCTURAL_SIGNIFICANT" }); GetHostedElements(speckleWall, revitWall); return(speckleWall); }
public Base WallToSpeckle(DB.Wall revitWall) { var baseGeometry = LocationToSpeckle(revitWall); if (baseGeometry is Geometry.Point) { return(RevitElementToSpeckle(revitWall)); } RevitWall speckleWall = new RevitWall(); speckleWall.family = revitWall.WallType.FamilyName.ToString(); speckleWall.type = revitWall.WallType.Name; speckleWall.baseLine = (ICurve)baseGeometry; speckleWall.level = ConvertAndCacheLevel(revitWall, BuiltInParameter.WALL_BASE_CONSTRAINT); speckleWall.topLevel = ConvertAndCacheLevel(revitWall, BuiltInParameter.WALL_HEIGHT_TYPE); speckleWall.height = GetParamValue <double>(revitWall, BuiltInParameter.WALL_USER_HEIGHT_PARAM); speckleWall.baseOffset = GetParamValue <double>(revitWall, BuiltInParameter.WALL_BASE_OFFSET); speckleWall.topOffset = GetParamValue <double>(revitWall, BuiltInParameter.WALL_TOP_OFFSET); speckleWall.structural = GetParamValue <bool>(revitWall, BuiltInParameter.WALL_STRUCTURAL_SIGNIFICANT); speckleWall.flipped = revitWall.Flipped; if (revitWall.CurtainGrid == null) { if (revitWall.IsStackedWall) { var wallMembers = revitWall.GetStackedWallMemberIds().Select(id => (Wall)Doc.GetElement(id)); speckleWall.elements = new List <Base>(); foreach (var wall in wallMembers) { speckleWall.elements.Add(WallToSpeckle(wall)); } } speckleWall.displayMesh = GetElementDisplayMesh(revitWall, new Options() { DetailLevel = ViewDetailLevel.Fine, ComputeReferences = false }); } else { // curtain walls have two meshes, one for panels and one for mullions // adding mullions as sub-elements so they can be correctly displayed in viewers etc (var panelsMesh, var mullionsMesh) = GetCurtainWallDisplayMesh(revitWall); speckleWall["renderMaterial"] = new Other.RenderMaterial() { opacity = 0.2, diffuse = System.Drawing.Color.AliceBlue.ToArgb() }; speckleWall.displayMesh = panelsMesh; var mullions = new Base { ["@displayMesh"] = mullionsMesh, ["renderMaterial"] = new Other.RenderMaterial() { diffuse = System.Drawing.Color.DarkGray.ToArgb() } }; speckleWall.elements = new List <Base> { mullions }; } GetAllRevitParamsAndIds(speckleWall, revitWall, new List <string> { "WALL_USER_HEIGHT_PARAM", "WALL_BASE_OFFSET", "WALL_TOP_OFFSET", "WALL_BASE_CONSTRAINT", "WALL_HEIGHT_TYPE", "WALL_STRUCTURAL_SIGNIFICANT" }); GetHostedElements(speckleWall, revitWall); //Report.Log($"Converted Wall {revitWall.Id}"); return(speckleWall); }