ANDREWPCX Posted October 11, 2010 Posted October 11, 2010 Dear Friends, I've been working on an application for my company. We design aulminum profiles, but when getting properties from a hollow profile i first convert it into regions, but i must know which one is inside and wich is outside in order to subtract the inner part from the outer part. Could anyone help me? Quote
ReMark Posted October 11, 2010 Posted October 11, 2010 The user is prompted to indicate the region to subtract from first. The region to be subtracted is selected second. Think of your profile as you would two circles one inside the other. The smaller circle would be subtracted from the larger circle therefore it would be the second pick. Quote
ANDREWPCX Posted October 12, 2010 Author Posted October 12, 2010 I'm looking forward to some VBA code by wich i can automate the detection of hollow profiles and subtract the region inside from the outer one. Thus doing it manually would take me perhaps a week. I'll explain I receive it as polylines, i have to explode it and count how many 0.03" fillets there are, then convert it to a region. Then i have to subtract the inner region from the outer region and get area, and perimeter, from the area i calculate the ammount of pounds per foot and kilograms per meter(since that can be found through the profile's density). But in order to automate it, i need to be able to tel de vba code which is the inner and wich is the outer, otherwise, the automated subtraction would be a matter of luck. It is not a concept issue, it's a programming it through vba issue. Quote
ReMark Posted October 12, 2010 Posted October 12, 2010 What kind of "intelligence" would be required to differentiate between an inner and outer profile? How are these profiles differentiated in the drawing now? By layer? By color? By linetype? Other? Quote
ANDREWPCX Posted October 13, 2010 Author Posted October 13, 2010 Both are on the same layer, since i receive them all formated to print. But a certain time i have each on different acadentity variables. Therefore if you are so "intelligent":geek: please, using any method available, write vba code to determine, for any given 2 regions (on every case there is one inside and one outside), wich is the one inside and one is the one outside. input: regionentity1, regionentity2 Task for vbacode: which one is inside and which one is outside. Please, smarter people on the net, help me write this code. A perhaps not so intelligent one doesn't know how to make this thing happen on an automated basis to save some time in the future. Quote
SEANT Posted October 13, 2010 Posted October 13, 2010 If both of the Regions are single boundary (i.e., without holes) then would this work? If regionentity1.Area > regionentity2.Area then regionentity1.Boolean acSubtraction, regionentity2 else regionentity2.Boolean acSubtraction, regionentity1 End If If it is possible that the regions have holes (where the outer could have less area than the inner) then you could compare the two .GetBoundingBox returns. Certainly the Outer would have the large BoundingBox area. Quote
ANDREWPCX Posted October 13, 2010 Author Posted October 13, 2010 Simple and logic. It surprises me how simple it is. Thank you, i will use it. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.