Are there plans to add this functionality to the core dynamo node offering?
Hi @ddrennen2QDK2,
The Profile.ByStationsElevations
node can be used to create a new layout profile with PVIs (vertical curves not supported). Maybe that helps. Can you give some more details about what type of workflow you’re interested in?
I am adding a sanitary sewer lateral.
I have calculated the slope intercept of 2 lines.
I need to add a PVI into the point of intersection.
OK, understood. There’s a few technical hurdles in place at the moment, which is why this functionality hasn’t been added yet. In the meantime, does it work for your use case to just create the whole profile in Dynamo? Or are you restricted to working with an existing profile?
Work around is fine for now.
“Get the profile views of a profile” would also be a nice add…Profile.GetProfileViews.
Got it, will look into that.
I have the same problem. I have used two approaches, but both of them have some issues.
-
Delete Profiles by name with Remove → wait for removal [waitfor,pass] —> recreate Profiles using Civil3D Toolkit node → add PVIs.
Issue: For some reason unknown to me, using Dynamo Player the script had to be run twice to recreate the profiles. -
Same logic as 1. but in python using API.
Issue: It used to leave phantom Profiles that had to be audited, and the Prospector had to be refreshed manually, but after some code reconstruction it seems to be working, but still in testing phase.
The problem is that the ProfilePVICollection cannot be cleared as at least 2 PVIs have to remain, so either those PVIs are reset and new ones are added (nightmare with nested input lists), or delete and recreate the entire Profile and add PVIs.
I have one another idea: Clear() the ProfileEntityCollection and Add the PVIs, but haven’t got time for that yet. Also I haven’t tried the new node yet either.
# Load the Python Standard and DesignScript Libraries
import sys
import clr
# Add Assemblies for AutoCAD and Civil3D
clr.AddReference('AcMgd')
clr.AddReference('AcCoreMgd')
clr.AddReference('AcDbMgd')
clr.AddReference('AecBaseMgd')
clr.AddReference('AecPropDataMgd')
clr.AddReference('AeccDbMgd')
# 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 from Civil3D
from Autodesk.Civil.ApplicationServices import *
import Autodesk.Civil.DatabaseServices as civdbs
# The inputs to this node will be stored as a list in the IN variables.
dataEnteringNode = IN
adoc = Application.DocumentManager.MdiActiveDocument
editor = adoc.Editor
civdoc = CivilApplication.ActiveDocument
alignments = IN[0]
profileName = IN[1]
stations = IN[2]
elevations = IN[3]
def CreateProfile(alignments):
with adoc.LockDocument():
with adoc.Database as db:
with db.TransactionManager.StartTransaction() as t:
# Place your code below
profile1=[]
for alignment in alignments:
alignmentid = alignment.InternalObjectId
alignmentob = t.GetObject(alignmentid,OpenMode.ForWrite)
profiles = alignmentob.GetProfileIds()
if profiles:
for profile in profiles:
profileob = t.GetObject(profile,OpenMode.ForWrite)
if profileob.Name == profileName:
profile1 = profileob
profile1.Erase()
else:
pass
profile1 = civdbs.Profile.CreateByLayout(profileName, civdoc, alignment.Name, "0", "UNI_tervezett", "_No Labels")
# Commit before end transaction
t.Commit()
return profile1
pass
def DeleteandAddPVI(stations, elevations):
#profile = []
profileob = CreateProfile(alignments)
with adoc.LockDocument():
with adoc.Database as db:
with db.TransactionManager.StartTransaction() as t:
# Place your code below
PVIC = profileob.PVIs
for i in range(len(stations)):
PVIC.AddPVI(stations[i],elevations[i])
# Commit before end transaction
t.Commit()
return PVIC
pass
# Assign your output to the OUT variable.
OUT = CreateProfile(alignments), DeleteandAddPVI(stations, elevations)
Can you attached example drawing
Hey @ddrennen2QDK2, just wanted to circle back on this. Would the Alignment.ProfileViews
node fit your needs? In most cases, it should produce the same result as what a Profile.ProfileViews
node would do. So you would have Profile.Alignment
→ Alignment.ProfileViews
.
If you specifically want to know which profile views the profile is currently displayed in (i.e., the “Draw” option is checked), then that’s a different story.
yes, this does work. thanks for the follow up.