AutoCAD Plant 3D Forum
Welcome to Autodesk’s AutoCAD Plant 3D Forums. Share your knowledge, ask questions, and explore popular AutoCAD Plant 3D topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

plant report creator

3 REPLIES 3
Reply
Message 1 of 4
patpat78
740 Views, 3 Replies

plant report creator

hello

 

is it possible to had 20% on subtotale for part

 

for exemple when the report say you have 10 elbow 90°.. i need in an other columns it say 12 elbow 90°... 

 

because the report is the exact numbur of part but when we ship material we need more parts... 

 

i don't know if it's clear..

 

thank you

3 REPLIES 3
Message 2 of 4
dave.wolfe
in reply to: patpat78

Yes, you could do it using scripts. Look at the default 3d parts BOM and open the scripts section.  There is a function they use to get the total that will be used.  You can replace the two function below (feetInchesFromObject and tableCell4_SummaryCalculated) with the code below.

 

I've modified the function to return 120% of the items, and made it so any fractional value round up to 1", this part just affects the piping.

 

// Return the specified object as a double value formatted
// into feet and inches.
//
private string
feetInchesFromObject(object obj)
{

UsedFeetandInches = true;
System.Diagnostics.Debug.Assert(
obj != null,
/*NOXLATE*/"feetInchesFromObject: obj parameter is null");
if (obj == null)
return string.Empty;

double value = System.Convert.ToDouble(obj);
//add fudge factor to the double
value = 1.2 * value;
// Round the initial value to three decimal places
// to avoid borderline rounding cases than would
// have resulted in very small or very large fractional
// inches.
double inchesFull = System.Math.Round(value % 12, 3);
double inchesOnly = System.Math.Truncate(inchesFull);

//round up the inches if there are any fractional left overs from our fudge factor
if(inchesFull - inchesOnly > 0)
inchesOnly++;
// Compute the fractional inches, if any.
string fracText = string.Empty;
double frac = inchesFull - inchesOnly;

//make sure there are no fractional values

frac =0;
if (frac > 0.0) {
fracText = string.Format(
/*NOXLATE*/" 1/{0}",
System.Math.Round(1 / frac)
);
}

// We always include the feet and inches.
// The fractional inches are optional.
return string.Format(
/*NOXLATE*/"{0}'-{1}{2}\"",
System.Math.Truncate(value / 12),
System.Convert.ToString(inchesOnly),
fracText
);
}

 

private void
tableCell4_SummaryCalculated(
object sender,
DevExpress.XtraReports.UI.TextFormatEventArgs e)
{
UsedFeetandInches = false;
textFeetInchesIfColumnImperial(/*NOXLATE*/"MeasureUnit", e);
//don't do anything if we already calculated the feet and inches
if(UsedFeetandInches)
return;
//get the value
double sum = System.Convert.ToDouble(e.Text);
//add our fudge factor, and round up to the nearest integer ie 2.1 goes up to 3;
e.Text = Math.Ceiling(sum * 1.2).ToString();


}
bool UsedFeetandInches;

Dave Wolfe
Isaiah 57:15



Tips and Tricks on our blog: ASTI blog
EXPERT ELITE MEMBER
Plant 3D Wish list
Message 3 of 4
patpat78
in reply to: dave.wolfe

hello 

 

thank's for your answer 

 

i copy paste the script but it say erraor on line 57 any idea ?

Message 4 of 4
dave.wolfe
in reply to: patpat78

Try substituting this in the summary calculated section

 

where it says:


//get the value
double sum = System.Convert.ToDouble(e.Text);
//add our fudge factor, and round up to the nearest integer ie 2.1 goes up to 3;
e.Text = Math.Ceiling(sum * 1.2).ToString();

 

use this:

 

//get the value

double sum = 0.0;

try{

sum = System.Convert.ToDouble(e.Text);//add our fudge factor, and round up to the nearest integer ie 2.1 goes up to 3;
e.Text = Math.Ceiling(sum * 1.2).ToString();

catch{

//do nothing if we couldn't convert to a double

}

Dave Wolfe
Isaiah 57:15



Tips and Tricks on our blog: ASTI blog
EXPERT ELITE MEMBER
Plant 3D Wish list

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost