How can I RoundUp the rectangle to the nearest whole number? So when a rectangle that is an odd size i.e. 40.1"w x 12.135"h, it'll Round to 41 & 13.
________________________________
dLeeway = 0.5sr.Add ActiveLayer.CreateRectangle2(x - dLeeway, y - dLeeway, w + dLeeway * 2, h + dLeeway * 2)
Usually if you want to round up from x.5 you add 0.5 to the dimension. In this case add 0.999 to the dimension
dLeeway = 0.5
FinalWidth = int(w + dLeeway * 2 + 0.999)
FinalHeight = int(h + dLeeway * 2 + 0.999)sr.Add ActiveLayer.CreateRectangle2(x - dLeeway, y - dLeeway, FinalWidth, FinalHeight)
Rounds good but now the x & y are off.
Dim PrevRefPoint As cdrReferencePoint
Dim FinalWidth as int
Dim FinalHeight as int
PrevRefPoint = ActiveDocument.ReferencePoint
ActiveDocument.ReferencePoint = cdrCenter
ActiveDocument.ReferencePoint = PrevRefPoint
Unfortunately, there's a lot more to my macro and trying to figure out where to put the code is driving me nuts, in between designing signs, but perhaps it would be best to show the whole macro or even just a mockup of what the end result should be. Most of my code was copied from my other maros and kind of pieced together.
So far the x,y is still off no matter where I place it.
Myron said:but perhaps it would be best to show the whole macro or even just a mockup of what the end result should be
Describing what you want as an end result is a great place to start.
It can also help to describe what you are starting with.
It's easy to get tangled up in the "and this was how I was trying to get there" part!
I have a macro that's been working fine for years, just trying to both streamline it and make the Registration marks a minimal of .5" from the printed shapes
I thought this needed it own thread. :-)
How would I do this? - Code snippets feedback - Developer Area - CorelDRAW Community
Happy coding,
-Shelby