Profile from polyline (but with a twist)

Hi eveyone. I need to create a profile from a polyline (the top and bottom of a stairs 2D drawing as shown below).
image
The problem is that many other commands or graphs can only generate the profile from polyline if there is no vertical components. Is there a way to move the vertices of the vertical lines just a little (i.e. I have done this manually and 0.001 works fine) before generating the profile from polyline?
If I’m not being clear just ask me anything. I will upload the dwg that I’m practicing this. Thanks in advance.
Escaleras_Pedro_Caceres.dwg (1.9 MB)

ProfileFromPolyline.dyn (62.5 KB)

TRY THIS
FILE DYN FROM DYNAMO FORM

1 Like

Sorry for the late response. That is a very clever way to edit the geometry of the stair polyline. The polyline to profile part is not working tho. Did you make it work? Thank you so much for your response.

Hi
I already tried it does not work by adding a [AddPVI]

Most likely you need another way
AddFixedTangent Method (Point2d, Point2d)

It will work

I kinda get that I need dto use that method in a Python script, right? But I don’t know how to use Python in Dynamo. Can you guide me on where to learn or what to do to learn? Thanks.

Insha’Allah

Tomorrow
I will try it the second way

If you are trying to show the steps in a profile for visual sakes, perhaps another route would be to develop a script that produces a solid which represents the stairs which can be projected on to the profile view. I’ve used the free LX-Stair add-in (LX-Stair | Autodesk Civil 3D | Autodesk App Store) to make the solid and turned out pretty good. Likely you could do something similar with Dynamo.

2 Likes
import sys
import clr

# Add Assemblies for AutoCAD and Civil 3D APIs
clr.AddReference('acmgd')
clr.AddReference('acdbmgd')
clr.AddReference('accoremgd')
clr.AddReference('AecBaseMgd')
clr.AddReference('AecPropDataMgd')
clr.AddReference('AeccDbMgd')
clr.AddReference('AeccPressurePipesMgd')
clr.AddReference('acdbmgdbrep')
clr.AddReference('System.Windows.Forms')
clr.AddReference('Civil3DNodes')

# Create an alias to the Autodesk.AutoCAD.ApplicationServices.Application class
import Autodesk.AutoCAD.ApplicationServices.Application as acapp

# Import references from AutoCAD
from Autodesk.AutoCAD.Runtime import *
from Autodesk.AutoCAD.ApplicationServices import *
from Autodesk.AutoCAD.EditorInput import *
from Autodesk.AutoCAD.DatabaseServices import *
from Autodesk.AutoCAD.Geometry import *

# Import references for Civil 3D
from Autodesk.Civil.ApplicationServices import *
from Autodesk.Civil.DatabaseServices import *

adoc = acapp.DocumentManager.MdiActiveDocument
ed = adoc.Editor
civdoc = CivilApplication.ActiveDocument



Pipe = IN[0]
Pipe1 = IN[1]

PROFILE_VIEW = IN[2]




def move_labels(ids,Pipe1,PROFILE_VIEW):
	if not hasattr(PROFILE_VIEW, "__iter__"):
		PROFILE_VIEW = [PROFILE_VIEW]
		
	if not hasattr(Pipe1, "__iter__"):
		Pipe1 = [Pipe1]
		

	if not hasattr(ids, "__iter__"):
		ids = [ids]
	error_report = None
	res = []
	try:
		with adoc.LockDocument():		
		    with adoc.Database as db:		
		        with db.TransactionManager.StartTransaction() as t:		    
		            sampleLineId = PROFILE_VIEW[0].InternalObjectId
		            objVIEW = t.GetObject(sampleLineId, OpenMode.ForWrite)
		            c = len(IN[1])-1
		            for i in range(c):
		                
		                startpo = Point2d(ids[i], Pipe1[i])
		                endpo = Point2d(ids[i+1], Pipe1[i+1])
		                Entitiesq= objVIEW.Entities.AddFixedTangent(startpo, endpo)
		                res.append(Entitiesq)
		            t.Commit()
	except:
		import traceback
		error_report = traceback.format_exc()
	if error_report is None:
		return res    
	else:
		return error_report



OUT = move_labels(Pipe,Pipe1,PROFILE_VIEW)

1 Like