Adding 3D patterns to Diptrace pcb designs - Tutorial

Post here to teach people how to do something.

Moderators: Chuckt, Garth, bitfogav

Post Reply
User avatar
bitfogav
Moderator
Moderator
Posts: 915
Joined: Sun Mar 28, 2010 9:03 pm
Location: United Kingdom
Contact:

Adding 3D patterns to Diptrace pcb designs - Tutorial

Post by bitfogav » Sat Jun 07, 2014 8:47 pm

Hey people.. So if you're like me and are fed up of the lack of available 3D patterns in Diptrace then this is a way I have found to import your own or already made 3D patterns.

Diptrace uses .WRL (Virtual Reality Modeling Language (VRML)) file extensions for it's 3D patterns:
WRL files are plain ASCII text files. A WRL file includes data specifying 3-D details such as vertices, edges for a 3-D polygon, surface color, image-mapped textures, light and reflection mapping, and transparency.

What you need to do:
I have found a website 3DContentCentral.com it is a website which as Free 2D and 3D CAD Models of User-Contributed and Supplier-Certified Parts. But you will have to register to the website to download the files. Use the search box to search for your required part/component, Once you have found the part/component that you require: For an example Pin header you will need to select the number of contacts (pins) you require etc and then click the "Validate" box to update the component for download, then select the file type from the drop down box under "Free CAD download" this is IMPORTANT you must make sure that the correct file type is selected, you want to select the "VRML" file type, then click download.. The image below shows the steps required for download..
partexample1.jpg
partexample1.jpg (90.6 KiB) Viewed 9932 times
Once you have the downloaded 3D pattern, unzip it and put the file into Diptrace, I would probably rename the file to something like Pin_Header_8pin (depending on you're pattern) but leave the file extension, this will help you find the part in Diptrace later.
The folder that you will need to put the 3D pattern in will be under the installed Diptrace folder usually:
C:\Program Files\DipTrace\models3d

Now in Diptrace you need to Import (refresh) the 3D folder so that Diptrace finds the new component/components.
Tools > 3D Preview > Patterns and Models Search
importfilediptrace.jpg
importfilediptrace.jpg (55.92 KiB) Viewed 9932 times
Dialog box will open - All you need to do is click "OK" that is it! - the new component/components will be imported
patternmodelbox.jpg
patternmodelbox.jpg (65.7 KiB) Viewed 9932 times
Now onto selecting the component.
If you don't know what Voltage your country is using, you shouldn't be doing electronics ;-)

User avatar
bitfogav
Moderator
Moderator
Posts: 915
Joined: Sun Mar 28, 2010 9:03 pm
Location: United Kingdom
Contact:

Re: Adding 3D patterns to Diptrace pcb designs - Tutorial

Post by bitfogav » Sat Jun 07, 2014 9:05 pm

On your Diptrace design, select the part which you wish to update the 3D component for (right mouse click), and select 3D Model..
select£Dmodel.jpg
select£Dmodel.jpg (129.75 KiB) Viewed 9929 times
Find the imported component by clicking the "All Models" box, search down the list for the named component. (in my case the 8pin header).
findmodel.jpg
findmodel.jpg (118.54 KiB) Viewed 9929 times
Now this is the HARD part:
You need to adjust the component SIZE, X/Y/Z Shift, X/Y/Z Angle. The only way I can figure this out is by playing around with different values and checking what the component is doing in relation to the pattern outline.
You can move the pattern around inside the 3D pattern window, so you can see it more clearly.
As you can see from the image below, the component is now aligned correct to the pcb pattern.
Just click "OK" and the component/pattern will be added to the pcb design.
3dmodelprop.jpg
3dmodelprop.jpg (115.83 KiB) Viewed 9929 times
If you don't know what Voltage your country is using, you shouldn't be doing electronics ;-)

User avatar
bitfogav
Moderator
Moderator
Posts: 915
Joined: Sun Mar 28, 2010 9:03 pm
Location: United Kingdom
Contact:

Re: Adding 3D patterns to Diptrace pcb designs - Tutorial

Post by bitfogav » Sat Jun 07, 2014 9:18 pm

Now open the 3D pattern for your design, just click "OK" with the following box:
open3d.jpg
open3d.jpg (290.64 KiB) Viewed 9929 times
Now you're see you're new pattern on your pcb, Job done! :)
patternonpcb.jpg
patternonpcb.jpg (148.22 KiB) Viewed 9929 times
If you don't know what Voltage your country is using, you shouldn't be doing electronics ;-)

User avatar
brad
Site Admin
Site Admin
Posts: 2578
Joined: Fri Mar 26, 2010 10:30 pm

Re: Adding 3D patterns to Diptrace pcb designs - Tutorial

Post by brad » Sat Jun 07, 2014 10:30 pm

Wonderful write up bitfogav, thanks for taking the time to put it all together in such great detail.

I think this is such a useful tutorial, I have actually added it to the main bradsprojects site:
http://www.bradsprojects.com/adding-3d- ... -diptrace/

Thanks again!

User avatar
bitfogav
Moderator
Moderator
Posts: 915
Joined: Sun Mar 28, 2010 9:03 pm
Location: United Kingdom
Contact:

Re: Adding 3D patterns to Diptrace pcb designs - Tutorial

Post by bitfogav » Mon Jun 09, 2014 9:21 am

*UPDATE*

Since writing the tutorial I have noticed that some of the .wrl files which are downloaded from 3DContentCentral.com
are not the correct VRML version for Diptrace. Some files are (VRML v1.0), and some are (VRML v2.0) which is what Diptrace supports.
And some VRML files only allow the component to be one color, not very life like, and dull like the screenshot below!..
dullpattern.jpg
dullpattern.jpg (12.54 KiB) Viewed 9898 times

We have two options to try, that is if the downloaded .wrl(VRML) is not VRML v2.0 (you shouldn't need to do anything if it is VRML 2.0)
The easiest way to check is to open the .wrl file (I use notepad++) and check the top line of text, it will either say: VRML V1.0 or VRML V2.0

Link to NotePad++ here.

Option One -

If the .wrl(VRML) file is an VRML v1.0 file then it will contain the following "#VRML V1.0 ascii" We need to delete this top line of text within the file. delete= "#VRML V1.0 ascii".
This will make it so Diptrace can read it, but Diptrace will not find it within the 3D "models3d" folder (C:\Program Files\DipTrace\models3d).

I would recommend making a new folder within the installed Diptrace folder: For example "my3Dcomponents" and save the file in there!. e.g. C:\Program Files\DipTrace\my3Dcomponents

Next you will need to manually search for the component 3D pattern within Diptrace, open the 3D editor by right mouse click on component and selecting "3D Model.."(this is explained in the tutorial above). Find the new folder you created above with your component 3D file/files in. The arrow in the screenshot below shows the button to manually search for your component file.
findFile1.jpg
This shows how to manually find you're 3D files
findFile1.jpg (91.3 KiB) Viewed 9898 times
If the component is a dull color (like the component in top screenshot) we may be able to change it to make it more life like, this can be done by the following:

Open the component .wrl(VRML) file again, same file as before (with Notepad++) check/search the file and find the line of code "diffuseColor",

Might look something like this:

Code: Select all

diffuseColor [
 0.250980 0.407843 0.250980, 0.250980 0.407843 0.250980, 0.501961 0.709804 0.501961
]
Or

Code: Select all

diffuseColor [
 0.250980 0.407843 0.250980, 0.250980 0.407843 0.250980, 0.501961 0.709804 0.501961
 0.250980 0.407843 0.250980, 0.250980 0.407843 0.250980, 0.501961 0.709804 0.501961
 0.250980 0.407843 0.250980, 0.250980 0.407843 0.250980, 0.501961 0.709804 0.501961
 0.250980 0.407843 0.250980, 0.250980 0.407843 0.250980, 0.501961 0.709804 0.501961
]
Just delete everything within the square brackets []

Now within the square brackets [] you want to change the code with the color commands, now as most programming languages (HTML) the color format goes Red, Green, Blue.
For an example if you want the color Red then you would enter the following
1.0 0.0 0.0 - you need to enter every value for each of the colors even if you dont/need that color, it is still part of the color scale.
the scale for each color goes from 0.0 to 1.0
Here is a website which has a list of VRML colors VRML COLOR CHART.

Now the section of code should go between the square brackets and look something like this (this is the color grey/black):

Code: Select all

diffuseColor [
 0.34 0.34 0.34
]
Now I would advise you to save the file and test it within Diptrace to check the results, it is possible that the file contains more than one "diffuseColor" and if it do then it is possible that you may need to change that section of code within the file too to get the component looking how you want it.. take a note of which sections of code you change just in case you need to go back and try more different color values..
If you don't know what Voltage your country is using, you shouldn't be doing electronics ;-)

User avatar
bitfogav
Moderator
Moderator
Posts: 915
Joined: Sun Mar 28, 2010 9:03 pm
Location: United Kingdom
Contact:

Re: Adding 3D patterns to Diptrace pcb designs - Tutorial

Post by bitfogav » Mon Jun 09, 2014 9:36 am

Option Two -

Here we download a different file type from the same 3DContentCentral.com of the same component, this time you want to download the STL (.stl) file, instead of WRL, but we need to convert this file into .wrl (VRML 2.0) this can be done by downloading the FREE software Wings3D.
We import the STL file that we have just downloaded into wings3D - the following screenshot below shows how to Import the STL file
wingsImport.jpg
wingsImport.jpg (91.29 KiB) Viewed 9897 times
Once the component is imported we then just export the component but we need to select WRL 2.0.
This will make sure the file is now fully compatible with Diptrace, save the file in C:\Program Files\DipTrace\models3d
The screenshot below shows how to Export the 3D component into WRL 2.0
wingsExport.jpg
wingsExport.jpg (106.13 KiB) Viewed 9897 times
Now save the converted file within the Diptrace folder (C:\Program Files\DipTrace\models3d) and check the component within Diptrace, you might have to Import (refresh) the 3D folder so that Diptrace finds the new component,
(this is explained in the tutorial).

If the color of the component is all the same color (dull) then it is likely that you can only change the color of the component as one solid color, in other words all of the component will be the same color. You could try and change the .wrl (VRML) file by modifying the code within "diffuseColor" square brackets, just like what I explained in option one, it's very likely that the file will only contain one instance of "diffuseColor" though.

The other way is to learn how to use wings3D..
If you don't know what Voltage your country is using, you shouldn't be doing electronics ;-)

User avatar
bitfogav
Moderator
Moderator
Posts: 915
Joined: Sun Mar 28, 2010 9:03 pm
Location: United Kingdom
Contact:

Re: Adding 3D patterns to Diptrace pcb designs - Tutorial

Post by bitfogav » Tue Jun 10, 2014 12:14 am

Ok so I have been playing around with Wings3D and I have found a way of making the dull components all life like! :)

You will need to download STL file types from the 3D website, and Import them into Wings3D (all the info in previous post).

Now with the component in Wings3D you need to select the box in the top centre of the screen (see arrow in screenshot below)
dullArrow.jpg
dullArrow.jpg (129.81 KiB) Viewed 9891 times
Now you need to select all the component body, it's a bit like windows paint, use the LEFT mouse button to select all the bits of the shape (the shape turns red when selected)
componentBodySelected.jpg
componentBodySelected.jpg (121.27 KiB) Viewed 9891 times
Next you now want to RIGHT mouse click on the component, this will bring up a selection list, you will need to select "Material", you must Right click on "Material" to create a new material!..
materialColor.jpg
materialColor.jpg (115.27 KiB) Viewed 9891 times
You should now be faced with a text box, here you need to enter the text "body" and press enter, next you will see another box pop up like the following screenshot. Adjust the Diffuse shade (color) this will show you the shade of the component body. Note: selecting full black wont give the component a great look when it's imported into Diptrace, I set Diffuse so the part looks slightly dark grey. Once you are finished just click OK..
selectcolorshade.jpg
selectcolorshade.jpg (120.89 KiB) Viewed 9891 times
The component should now look something like this:
componentIsBlack.jpg
componentIsBlack.jpg (98.4 KiB) Viewed 9891 times
Do the same as before, this time select the pins of the components and right click on "materials" and enter "pins" in the text box.. You should see the same screen as before. I set Diffuse so the pins look almost silver. just click OK when finished..
pinColorSelection.jpg
pinColorSelection.jpg (126.73 KiB) Viewed 9891 times
Now for the last part, Export the component from Wings3D (Convert the file to WRL 2.0) and Import the component into Diptrace.
componentInDiptrace.jpg
componentInDiptrace.jpg (92.51 KiB) Viewed 9891 times
If you don't know what Voltage your country is using, you shouldn't be doing electronics ;-)

User avatar
brad
Site Admin
Site Admin
Posts: 2578
Joined: Fri Mar 26, 2010 10:30 pm

Re: Adding 3D patterns to Diptrace pcb designs - Tutorial

Post by brad » Tue Jun 10, 2014 11:27 pm

Very nice addition to your tutorial Gav, I'm off to bed now but hopefully tomorrow sometime I'll be able to update this on the main bradsprojects site.

I have to say, since you posted this tutorial, I have now been downloading and importing all missing components so my boards look great in 3D. Previously I would just leave the board as is which looked quite bare. Now it's full of 3D components!

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests