Hi.
I have a subassembly with 2 slopes. The first slope (AL1 link) is 3H:2V. It´s in the top, and the second slope (AL2 link) is 1H:1V and it is in the bottom.
My goal is that the height of AL1 was always <= MaxHeigth_Slope1 input variable (by default 3 meters).
In case of being <= 3 meters, then the subasssembly will be only one slope (3H:2V) ---> this is the first Decision (false value)
If it is not, we will do a loop from an interpolated auxiliar point from P1 to AP2.
There is a input variable named PercentIncrease (by default 5%) to increase that percent in each loop.
If I did in C#, perhaps it would be:
double Count=0;
double CurrentHeight=0; //from interpolated point
double LengthSlope2=AL2.Length;
double Percentual=Count*PercentIncrease;
Do
{
if(Percentual<=100) // <= 100%
{
//every time we create automatically an auxiliar point (AP3 in the sample from P1 to AP2, type= Interpolate, value=Percentual/100)
// we create automatically other auxiliar point (AP4 in the sample from AP3 to surface, type= Slope to surface, Slope=Slope1)
CurrentHeight=AP4.Y-AP3.Y;
if( CurrentHeight<= MaxHeigth_Slope1)
{
//we create real points
//new point (newP3) on the previous auxiliar point(AP3) new Link from P1 to newP3.
//new point from newP3 to surace and new link .
}
else
{
Count++;
Percentual=Count*PercentIncrease;
}
}
}
While (CurrentHeight<=MaxHeightSlope1)
in SAC 2015:
http://www.mediafire.com/download/7dc8236u6zg2amb/Double+Slope+Starting+from+Daylight.rar
Thanks.
I'm not currently running 2015 so I can't open your file to see what you have alredy created but to answer your question regarding how you would program it in C#, there are no loops currently available in SAC.
Am I correct in assuming what you want is to have a single link from point P1 to the surface, ideally you want a 3H:2V slope if the height of this link is less than 3 m, but if it is going to be greater than 3 m, then you want the slope to be steeper in order to meet the height criteria? Do you need the slope to be an definable slope (i.e. using the 5% increment) or can any slope that meets the height criteria suffice?
Try this (NOTE: This is just me throwing together a subassembly with no testing it in Civil 3D, not sure if it will work but it looks good in theory and may get you pointed in the right direction, sadly intersections and surface links are hard to test in SAC).
Define P1
Define interger varilable CutOrFill [If(P1.distancetosurface(DaylightSurface)>0,-1,1)]
Define AP1 & AL1 using [CutOrFill*Slope1]
Test if [math.abs(AL1.ylength)<=MaxHeight]
-TRUE (math.abs(AL1.ylength)<=MaxHeight)
Define P2 at AP1
Define L1 as P1 to P2
-FALSE (math.abs(AL1.ylength)>MaxHeight)
Define AP2 from P1 DeltaX=0, DeltaY=CutOrFill*MaxHeight
Define AP3 from AP1 DeltaX=MaxHeight/Slope1, DeltaY=0
Define Auxiliary Surface Link (AP4, AP5, and AL3), SurfaceTarget=DaylightSurface, Start X =0, End X= MaxHeight/Slope1
Define Auxiliary Intersection AP6, Link AL2 and AL3
Define P2 at AP6 (assuming you don't care if the slope is an even percentage increase) and define L1
If you do care that the slope is an even percentage increase, then create AL4 from P1 to AP6, and define a double variable Slope2=math.floor(AL4.slope*100/PercentIncrease)*PercentIncrease and then define P2 & L1 using Slope2
Kati Mercier, P.E. | LinkedIn | AutoCAD Civil 3D Certified Professional
Pronouns: She/Her
Co-author of "Mastering AutoCAD Civil 3D 2013"
AU2019 Speaker::: CES321590: Analyze and Revise Existing Subassembly Composer PKT Files for AutoCAD Civil 3D
AU2017 Speaker::: CI125544: Analyze and Devise in Subassembly Composer
AU2012 Speaker::: CI3001: Reverse Engineering with Subassembly Composer for AutoCAD Civil 3D
AU2011 Speaker::: CI4252: Create Subassemblies That Think Outside the Box With Subassembly Composer for AutoCAD® Civil 3D®