Click here to Skip to main content
15,885,891 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
I work for a company that builds structural steel buildings. My primary position is basically anything to do with IT, but we have been building a complete system that links all our departments together, from pre-quotation to post shipping.
One of the biggest challenges in this has been to create a connection that links our CAD files to our Database to create our Bills of Materials. We have pretty much all of it functioning now, but one thing still eludes me. We have a "tag" in AutoCAD for each of the items on the building, which exports to Excel to let us know how many of each length we need for said building, but we have to manually calculate how many total pieces we need to buy. I'll try to visualize below:

If the building has:
(4) @ 4' 3-15/16"
(2) @ 4' 2 1/8"
(5) @ 2' 6"

Then we need to buy (2) total 20' lengths. AutoCAD and Excel do all the math for calculating the individual lengths, but not the total lengths. I can't simply add up the lengths and divide by 20 as that will not be accurate.

Is there a way to automate this process?

(Also, I don't post here often, so forgive me if I stated something improperly or did something wrong.)

EDIT: I probably should add that our Database is written in MySQL with interfaces written in HTML5/CSS3 and using PHP and JS/JQ for any functionality.
I am more than happy to any details that may be needed, but as I don't know exactly what I am looking for, I don't know what is relevant and what's not.

EDIT 2: What it is that I am looking for is a way to calculate the total number of pieces needed to be able to cut all of the individual smaller pieces with the smallest scrap possible. We may get a particular item in 24 foot lengths, but will have 2 pieces that need to be 16 feet and 4 that need to be 7 feet. In total lineal feet, that means that I could technically use 3 pieces, but in reality, after getting those pieces and cutting them, we would need 4 because each piece loses 1/16 of an inch due to the saw blade. This would be a small example, as many of our jobs need 20+ 24' lengths that we will then cut into said smaller pieces.

I THINK what I need is a way to loop through each item, and basically add as many items to a new length until I can't fit any more, then add a new Item and repeat, and have it loop through from longest to shortest... something along those lines, but I need someone smarter than myself to point me in the right direction...
Posted
Updated 7-Apr-15 4:52am
v3
Comments
Sergey Alexandrovich Kryukov 7-Apr-15 9:38am    
One of your strategic problems is that you are trying to do serious business with things like Excel, which is designed for office workers. (AutoCAD is also not a really good thing, but I hardly can help you here.) In other words, there is a good principle I read somewhere: "develop software, don't integrate". Following it, at least partially, would solve your problem.
—SA
Zachery Hysong 7-Apr-15 10:14am    
Well, I agree with you. But the decision to use Excel and AutoCAD or not is, unfortunately, not mine to make. That being said, All Excel is actually doing is converting the exported information from AutoCAD to a CSV File. Once it does that, I do the rest of it with PHP and JS/JQ. We have a plugin for AutoCAD called AutoAttribute that takes all of our custom tags and exports them to either an AutoCAD Table or an Excel Table. We have not been able to find any other plugin that works with AutoCAD and AutoCAD LT that comes close to this functionality. I am in the process of learning how to program for AutoCAD and LT, but until then, I am stuck with what I have. Do you have any suggestions that might point me in the right direction, within these parameters?
Sergey Alexandrovich Kryukov 7-Apr-15 10:28am    
Yes, CSV file... and so on... You have a general systemic problem: using the low-tech (but the bloated) where something serious is needed, and, ultimately, something much simpler. (Simpler because integration itself takes disproportional resources; roughly speaking, you waste 95% of the effort for plumbing, not the essence of the technology. It's like connecting a number of miserable $30 devices with $1000+ network equipment.) Sorry, I don't know what to suggest, in the framework of your settings.
—SA
Zachery Hysong 7-Apr-15 10:30am    
I am thinking that maybe we are not on the same page... I have all the information I need, and I can move it and convert it as needed. What I am looking for is an algorithm of sorts to determine the information stated above. If what I have is not plausible, what would you suggest?
vbmike 7-Apr-15 10:34am    
Hi Zach, I am wondering why Excel cannot do this for you? Prior to exporting to the database? Just looking at your question, it seems that it would be easy to do within Excel.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900