Showing results for 
Search instead for 
Did you mean: 

Costing Macro

Valued Contributor
Valued Contributor

Figured i would move this out of the introduction forum. I've just starting working on the costing macro. The plan is to calculate the outer loop perimeter distance and the none punched features. Using hourly costing rate for the laser and the laser feed rate its should allow for the laser time estimate. One second is added for any punched hole. Bend count is used to determine the number of unique bends and a average bend time is applied. Plus a standard setup time for each change in bend length. These calculations will use a standard brake rate. Lastly it will feed in the cost per sheet of the material used and determine the cost of the area used plus a variable for scrap rate. Paint is then a area to hourly rate ratio that would be added to the part.


Most of the bends and hole feature data gather is not a problem. I've been struggling with how to calculate the outer loop perimeter correctly. I know that you should be able to get the outer loop line details because they are used to create a DXF so the data is within the flat pattern.  


I've looked thru the API and the only why i've been able to get any line data from the flat pattern is using the EdgeUses collection from within the loops collection. This allow me to determine if the loop line sections are top facing but not if they are outerloop line sections.


Any ideas would be help.


Re: Costing Macro


That looks like an excellent macro, and is literally the same approach I took when starting to write mine. I could not get cut length, either, and gave up on this in favor of a more simplistic costing macro about a month ago because of an avalanche of work. I have been itching to revisit this, perhaps in the next week or so. 


I will watch this thread with great interest!

-Dylan Gondyke

Re: Costing Macro

Valued Contributor
Valued Contributor

After so more thought last night and some digging in the API. I tried to go another way about getting the information. I found that if you take the flat pattern and place it on to a quick sheet that just has the flat pattern on it. Then you are able to return the DvLine2d details from the drawing view for all the lines and the centerlines. Each of the DvLine2d lines it lists the angle at which the line is parellel to and the type of line that it is. By just looping thru the graphicmembers array and only summing the lines that dont match the varibles listed in the centerlines you can get the perimeter length.


Its a dirty solution but it should be functional. I plan to do the code for this tonight and i'll let you know how it works.

Re: Costing Macro

Siemens Valued Contributor Siemens Valued Contributor
Siemens Valued Contributor

I mentioned this to one of the Solid Edge developers.  They are heads down on ST7 right now but he did suggest this:


I looked at our API and it seems like you should be able to get the outer loop of a flat pattern using the following approach, although this would need to be verified:


-          FlatPattern.Edges(igQueryAll)

-          For each edge:  Edge.GetEdgeUses

-          For each edge use object:  EdgeUse.Loop

-          Loop.IsOuterLoop – if true, the edge associated with this loop is part of an outer loop.