Hey all,
I’ve been working on getting the inner perimeter of enclosed walls and my final method was to get the surfaces on the bottom of the wall geometry. Finally I got sets of curves that that make up both the inner and outer perimeter.
Anyone know of the better way to separate the inner curve from the outer curve?
Atm I am getting the location of the wall elements that give me the center line of the wall, from which I create a surface and intersect with the curves, managing to catch the inner curve that intersects with the sufrace.
I later try to move on to getting the curve for the full segment of wall, but as you can see in the attached picture, there is a point added to the connected part between the walls and I can’t manage to get the full length of the chord. I have tried creating a surface and then get the corners or edges, tried creating polycurve, nurbcurve and and still am stuck with the point along the line where the surface of the two walls meet. Part of the issue is that the curves aren’t organized of subsequent curves so when I create polygon it has lines crossing all over.
Any suggestion of how to overcome this and get the points of the corners or the start and end of lines without having point mid curve?
You can do this with Python, but it is one of the ethics which wasn’t added to the library ages ago. I’ll see if I can find an example but am traveling so internet may be hard to come by. Just incase I don’t, the process is:
Bring the standard Dynamo geometry library into Python.
Bring the geometry from IN[0] in as ‘geo’
Pull the faces of the geometry with something like geo.faces
For each face:
pull the coedges
Remove any coedges which don’t have a true ‘IsExternal’ property.
Pull the ‘edge’ from each coedge.
Pull the curve geometry from the edge, and append it to the list of inner curves.
You can similarly divide the inner and outter curve set by pulling the edge and curve geometry and then appending to the ‘internal’ or ‘external’ loop based on the value of the ‘isexternal’ property.
########################################
############## Properties ##############
########################################
__author__ = 'Jacob Small'
__version__ = '0.1.0'
__description__ = """ """
__DynamoBuilds__ = "3.1, but expected to work as far back as 2.8."
__ReleaseNotes__ = "Only tested in Dynamo 3.1 - test other builds closely before deploying to production."
__Dependancies__ = "None"
__Copyright__ = "2024, Autodesk Inc."
__license__ = """Apache 2.0"""
########################################
### Configure the Python environment ###
########################################
### standard imports ###
import sys #add the sys class to the Python environment so we can work with the sys objects
import clr #add the CLR (common language runtime) class to the Python environment so we can work with .net libraries
### basic Dynamo imports ###
clr.AddReference('ProtoGeometry') #add the Dynamo geometry library to the CLR
from Autodesk.DesignScript import Geometry as DG #add the Dynamo geometry class using the alias DG, to ensure no overlap between class calls in Revit or Dynamo
#########################################
###### Global variables and inputs ######
#########################################
geo = IN[0] #surface class object from the IN[0] port of the Dynamo environment
external, internal = [],[] #defining empty lists for the external and internal curve loops
#########################################
############# Get all loops #############
#########################################
faces = geo.Faces #get the faces from the geometry object
for face in faces: #for each face
loops = face.Loops #get the loops
for loop in loops: #for each loop
crvs = DG.PolyCurve.ByJoinedCurves([coEdge.Edge.CurveGeometry for coEdge in loop.CoEdges]) #build a polycurve form the set of each coedge's edge as curve geometry
if loop.IsExternal: external.append(crvs) #if the loop is external append it to the exetrnal set - for a regular surface there should only be one of these
else: internal.append(crvs) #otherwise append it to the internal set
#########################################
##### Return the results to Dynamo ######
#########################################
OUT = {"external": external, "internal": internal} #sends polycurves back to the Dynamo environment in a dictionary
You could create 2 polycurves by using polycurve.byjoinedcurves then turn each polycurve into a surface. Find the area of each surface and the smaller will be the inside curves. Which you can extract the curves from said inner polycurve. Hope that makes sense, written on phone at 1:21am lol
Just thought of another option. There is a node to get reference of the walls and not location. If all walls have the exterior to the outside you can find all the interior horizontal references, turn these into curves and voila. This might be from a custom package. Will edit this post with more info in the morning.
I haven’t been working with rooms and spaces and would have to get more familiar with these functions. This is a clean model where I have only selected walls and got certain walls that weren’t drawn in a particular order.
Thanks for the response.
I will try to figure this out. Would the action be to select the walls and assign it a room and that will give the inner and outer wall boundary?
Hi Jacob, thanks for the response.
Can you explain what exactly face.Loops does or where I can check it up?
Does it know how to detect inner/outer boundaries?
I tried the script you suggested, just that I did it using code blocks. As you can see in the img attached, all loops are defined as “IsExternal”.
Was this part supposed to filter out the inner and outer curves?
I will just emphasis that the walls selected were pulled from a project in which they haven’t been drawn in a chain, rather in random order and direction. I am guessing that that has an impact.