Hi everyone, today I want to share a quick guide on how to import a QR code or any pattern from a PDF file into SolidWorks as vector lines, which is something I recently experienced during a freelance job. I hope you find it useful too.
Our goal is to cleanly transfer the pattern into SolidWorks as sketch lines.
Important: Dear moderators, I accidentally shared this under the Questions section. Could you please mark or move this as a regular Post?
Step 1: Open the PDF file in AutoCAD using the PDFIMPORT command
Open a blank AutoCAD drawing, type PDFIMPORT in the command line, and run the command. Click on the File option in the command line prompt and select the PDF file you want to insert.
In the window that appears, check the settings as shown and then click OK.
After clicking OK, the pattern gets imported into our AutoCAD screen like this.
Next, select everything outside the pattern and delete it using the Delete command. You can see the final result in the image below.
After this step, you need to use Save As and save the file to your computer in DXF format. You can save it as AutoCAD 2018 DXF.
From this point on, we are done with AutoCAD. Our only goal was to cleanly extract the pattern from the PDF and save it as a DXF.
Step 2: Import the DXF File into SolidWorks
Now it is time to import our pattern into the part file. Open your part and select the face where you want to add the sketch. This step is important. After selecting the face, go to Insert > DXF/DWG.
In the window that opens, select the DXF file you saved earlier. Once selected, a screen like this will appear. Make sure to uncheck Import as reference here, otherwise it uses the coordinate reference from AutoCAD, so unchecking it is important.
Then click Next.
After clicking Next, a screen like the one below should appear. We do not need to change any settings here. HOWEVER, make sure to set your unit under Units of imported data in the top left corner according to your part's unit system. Since we usually design in millimeters, you can select Millimeters. From here, just click Finish to complete the process.
As you can see in the image below, the program will open a sketch on the face we initially selected and place our pattern into it. It might turn out much smaller than your actual part, which is totally normal. We can scale it up later using the Scale Entities tool.
Our pattern is now created. Each line here is separate and not linked to the others. So if you want to move it around as a single piece, you can select all the lines, right-click, and use the Make Block command. This turns the entire pattern into a single sketch block.
You can see what I mean in the second image below.
Step 3: Resizing the pattern to the desired dimensions
At this point, we are going to resize the pattern to match the face we want to place it on. As you can see in the image below, my surface measures 100x100 mm. So we need to scale our pattern accordingly using simple proportions.
As you can see, my QR code is 6x6 mm. To scale it up to 100x100 mm:
Select the entire pattern
In the Parameters section on the left, type 100/6 into the Block Scale field and press Enter. (You can see this in the second image below)
Once you enter 100/6 and hit Enter, our pattern will be exactly 100x100 mm. This way, you can easily position and dimension your sketch however you like.
If you are importing a QR code like in this example, you can place it on the target face and use Extruded Boss/Base or Extruded Cut to generate the geometry on your surface. Just keep in mind that selecting the contours during the extrusion process can be a bit tricky, so you might need some patience when picking the regions to extrude.
And that is it. You can cleanly import your patterns into SolidWorks without any issues this way. That is all there is to it.
Thank you for reading this far. I would be very happy if this helps even one person. Feel free to leave a comment if you have any questions.
Berke GEDUK
LinkedIn : www.linkedin.com/in/berke-geduk
