Hello, a question about which nodes could be used to do what is in the video, of course, if possible, I sent the first part, which is for the sample line, but the section views would be missing.
I have a work in progress for section views, it creates the views, I had some issues with styles, modify it for your needs:
# 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 *
from Autodesk.Civil.DatabaseServices import *
# The inputs to this node will be stored as a list in the IN variables.
dataEnteringNode = IN
#sample line groups
SLGS = IN[0]
#insertion point
P = IN[1]
#station range, 0 if from start to end
SSin = IN[2]
ESin = IN[3]
#placement type 0 if draft anything else if production
placement = IN[4]
templatepath = IN[5]
layoutname = IN[6]
adoc = Application.DocumentManager.MdiActiveDocument
editor = adoc.Editor
civdoc = CivilApplication.ActiveDocument
with adoc.LockDocument():
with adoc.Database as db:
with db.TransactionManager.StartTransaction() as t:
# Place your code below
P1 = Point3d(P.X, P.Y, P.Z)
for SLG in SLGS:
SLGId = SLG.InternalObjectId
SLGOb = SLGId.GetObject(OpenMode.ForWrite)
SLGS = SLGOb.GetSectionSources()
for source in SLGS:
st = source.SourceType
if str(st) == "TinSurface":
source.IsSampled = False
source.IsSampled = True
source.StyleId = civdoc.Styles.SectionStyles["UNI_terep"]
if str(st) == "Corridor":
source.IsSampled = False
source.IsSampled = True
source.StyleId = civdoc.Styles.CodeSetStyles["UNI_Keresztszelvény_Kiviteli"]
else:
pass
sn = source.SourceName
if str(sn) == "Terep":
EGId = source.SourceId
PA = SLGOb.ParentAlignmentId.GetObject(OpenMode.ForRead)
if SSin == 0:
SS = PA.StartingStation
else:
SS = SSin
if ESin == 0:
ES = PA.EndingStation
else:
ES = ESin
rangeOptions = SectionViewGroupCreationRangeOptions(SLGId)
placementOptions = SectionViewGroupCreationPlacementOptions()
if placement == 0:
placementOptions.UseDraftPlacement()
else:
placementOptions.UseProductionPlacement(templatepath,layoutname)
sectiondisplayOptions = SectionDisplayOptionCollection(SLGId)
for option in sectiondisplayOptions:
option.Draw = True
#sectiondisplayOptions[0].UseOverrideStyle = True;
#sectiondisplayOptions[0].OverrideStyleId = civdoc.Styles.CodeSetStyles["UNI_Keresztszelvény_Kiviteli"];
sectionViewStyleId = civdoc.Styles.SectionViewStyles["UNI_ksz rajz"]
sectionViewBandSetStyleId = civdoc.Styles.SectionViewBandSetStyles["UNI_ksz_lábléc"]
SVGC = SLGOb.SectionViewGroups
SVGS = SVGC.Add(P1,SS,ES,rangeOptions,placementOptions,sectiondisplayOptions,sectionViewStyleId,sectionViewBandSetStyleId)
SVGS.PlotStyleId = civdoc.Styles.GroupPlotStyles["UNI_ksz_csoportnyomtatás_420"]
SVIds = SVGS.GetSectionViewIds()
for SVId in SVIds:
SV = SVId.GetObject(OpenMode.ForWrite)
SL = SV.SampleLineId.GetObject(OpenMode.ForWrite)
EGsectionid = SL.GetSectionId(EGId)
bottombanditems = SV.Bands.GetBottomBandItems()
for bottombanditem in bottombanditems:
#if bottombanditem.BandStyleId == civdoc.Styles.BandStylesRoot.SectionViewSectionDataBandStyles["UNI_ksz_terep magasság"]:
bottombanditem.Section1Id = EGsectionid
SV.Bands.SetBottomBandItems(bottombanditems)
#else:
#pass
P1 = Point3d(P1.X,P1.Y-70,P1.Z)
sectiondisplayOptions.Dispose()
# Commit before end transaction
t.Commit()
pass
# Assign your output to the OUT variable.
OUT = bottombanditems