Hi everybody, this is my first post in this forum and my entire knowledge of CorelDraw is using it for laser cutting. So my apologies in advance if I'm making any mistakes (e.g. asking the question in the wrong forum etc)
We have a laser cutting machine in our lab which uses coreldraw to export the drawings to laser cutting software as virtual printer. We also use solidworks to draw the sketches and export as DXF. when opening the DXF files in CorelDraw one has to do a lot of adjustments which is irritating and time consuming. I want to write a macro which automates these steps. consider this drawing for example:
the steps to adjust this drawing are:
I was wondering if any of you could help me to know how I can write this macro.
Thanks in advance
P.S. here you may find an example of the dxf file.
There are of course different ways of approaching this. Here's one way:
Sub work_on_DXF() Const dbl_margin_mm As Double = 0.5 Dim s As Shape Dim unitDoc As cdrUnit unitDoc = ActiveDocument.Unit 'delete all shapes with 0.18 mm line width ActivePage.Shapes.FindShapes(Query:="@outline.width = {0.18 mm}").Delete Set s = ActivePage.Shapes.All.Group s.Outline.Width = ConvertUnits(0.003, cdrInch, unitDoc) s.Outline.Color.RGBAssign 255, 0, 0 ActivePage.SetSize s.SizeWidth + 2 * ConvertUnits(dbl_margin_mm, cdrMillimeter, unitDoc), s.SizeHeight + 2 * ConvertUnits(dbl_margin_mm, cdrMillimeter, unitDoc) s.CenterX = ActivePage.CenterX s.CenterY = ActivePage.CenterY ActiveDocument.Save End Sub
Are you interested to make a github gist for this?
At this time, not really, for a couple of reasons:
1. Small scope of this macro.
2. Even though it's a bit messy, it's of some benefit to have the code snippets here on the CorelDRAW Community site for others to be able to find. More than once I have found answers by "mining" this site and the Oberon Place forums.
What I would REALLY like to see is a non-version-specific "Macros for Users" forum here on the Community site. So much potential there!