差别
这里会显示出您选择的修订版和当前版本之间的差别。
两侧同时换到之前的修订记录 前一修订版 后一修订版 | 前一修订版 | ||
kicad6install3d [2022/04/10 10:58] gongyusu [第三方3D资源库的下载] |
kicad6install3d [2022/04/15 14:04] (当前版本) liping [3D模型的安装、获取和关联] |
||
---|---|---|---|
行 1: | 行 1: | ||
## 3D模型的安装、获取和关联 | ## 3D模型的安装、获取和关联 | ||
- | + | [[KiCad]]的3D查看器可以显示封装的三维效果,当然前提是已经为这个封装关联了3D模型。3D模型的文件比较大,因此在安装KiCad软件的时候,却是不安装的,可以后期根据自己的需要按照向导来安装。 | |
- | [[KiCad]]的3D查看器可以显示封装的三维效果,当然前提是已经为这个封装关联了3D模型。3D模型的文件比较大,因此在安装KiCad软件的时候,缺省是不安装的,可以后期根据自己的需要按照向导来安装。 | + | |
### 官方库的下载和更新 | ### 官方库的下载和更新 | ||
行 31: | 行 30: | ||
- | ### 第三方3D资源库的下载 | + | ### 第三方3D资源库的下载和关联 |
+ | 无论KiCad官方提供的3D库多么全,电路板上总有一些器件在KiCad库中没有匹配的3D形状。 | ||
+ | |||
+ | 在这些情况下,我们有两个选择: | ||
+ | - 在第三方提供商中寻找匹配的形状。 | ||
+ | - 自己做一个匹配的形状。 | ||
+ | |||
+ | 这里我推荐一个有丰富3D模型库的第三方资源网站[[https://grabcad.com|Grabcad.com]],并简单介绍一下如何从这个网站上查询、下载你想要的3D模型。 | ||
+ | |||
+ | 为了演示如何导入3D形状,我们将使用本书项目1中的PCB。我们的起点是项目1结束时,最终的PCB是这样的: | ||
+ | 它看起来已经很好了,大多数元器件都已经有了3D的模型,只有两个器件还没有 - 筒形接头与滑动开关不匹配。 | ||
+ | |||
+ | 让我们从桶形接头开始。去grabcad.com,用搜索栏搜索这个形状。这可能需要一些尝试,因为许多组件的命名没有标准化或使用。筒形连接器可称为“直流电源插头”或“直流电源连接器”或“EJ5035连接器”等。几次尝试后,我找到了我要找的形状。你也可以在[[https://grabcad.com/library/ej503b-connector-1|ej503b-connector-1]]上找到它。 | ||
+ | |||
+ | 一旦你找到你需要的形状,寻找扩展名为“.stp”的可下载文件。stp文件,发音为“STEP”,是一种常用的表示3D对象的数据交换格式。KiCad中的3D查看器可以使用这种文件格式。 | ||
+ | |||
+ | 图57.2 .stp文件包含3D形状的数据 | ||
+ | |||
+ | 下载EJ503B-ND.stp文件。我把它保存在我的3D形状文件夹项目目录,方便以后找到。 | ||
+ | |||
+ | 接下来,启动Pcbnew(如果还没有启动的话)。将鼠标悬停在桶连接器上,并调出占用空间属性窗口 | ||
+ | |||
+ | 按“E”键(或右击以获得上下文菜单,并选择Properties)。 | ||
+ | |||
+ | 在属性窗口中,点击3D设置选项卡。 | ||
+ | |||
+ | 在我们分配一个新的3D形状之前,通过选择删除现有的一个 | ||
+ | |||
+ | 点击3D模型面板中唯一的一行,然后点击垃圾桶按钮。即使有一个赋值,这个特定的wrl文件在我的计算机上不存在。 | ||
+ | |||
+ | 让我们添加新的3D形状。单击3D Models窗格右边的文件夹按钮,并导航文件系统到您之前保存STP文件的位置。单击STP文件,查看器将在右侧窗格中显示3D形状。 | ||
+ | |||
+ | 图57.4:我们将选择这个3D形状;它的预览确认这是我需要的模型。单击OK接受此选择,然后返回到封装属性窗口。正如我们看到的,3D形状在预览中是不可见的,但它不在正确的位置。 | ||
+ | |||
+ | 图57.5:新的3D形状是模型的一部分,但它不合适。 | ||
+ | |||
+ | 现在,我们必须手动地在PCB上定位3D形状 | ||
+ | |||
+ | 我们希望它出现在最终的面板渲染中。使用比例,旋转和偏移控制来做到这一点。经过一些努力,这个封装的最终3D模型将是这样的: | ||
- | The 3D viewer in Pcbnew provides an excellent way to visualise your board before you send it out for manufacturing. Out of the box, the 3D viewer will show you what your board will look like, and can render the PCB itself, the traces, copper fills and all pads and holes. | + | 图57.6:新的3D形状是模型的一部分,但它不合适。一定要从各个角度检查模型,以确保一切都是一致的。也看它从底部,以确保销和孔对齐。对齐完成后,单击“Ok”提交更改。 |
- | The 3D Viewer can also visualise the components that will eventually be attached on the board, so that you can have a complete picture of the final product. | + | |
- | KiCad ships with a comprehensive library of 3D shapes as a seperate download (because of its size). See recipe ”55. How to install 3D shapes” for more information on how to do that. | + | |
- | However comprehensive this library may be, there will always components on your board that don’t have a matching 3D shape available in KiCad’s library. | + | |
- | In those cases, you have two options: | + | |
- | 1. Look for a matching shape in a 3rd party provider. | + | |
- | 2. Make a matching shape yourself. | + | |
- | In this recipe, you will learn how to find and import a 3D shape from one such provider, Grabcad.com. You can follow the same process to import shapes from other providers. In a separate recipe, you will also learn how to create your own shapes. | + | |
- | To demonstrate how to import a 3D shape, we’ll work on the PCB from Project 1 of this book. Our starting point is the end of Project 1, when the final PCB looks like this: | + | |
- | It already looks good, with most of the components having a match in the | + | 让我们来看看整个PCB的3D渲染。打开3D查看器。它应该是这样的: |
- | KiCad 3D shape library. But, two components don’t. The barrel connector and the slide switch have no match. | + | |
- | There are many contributed 3D shapes and shape libraries available on the Internet. In this recipe, we’ll use grabcad.com to find the missing shapes for this PCB. | + | |
- | Let’s start with the barrel connector. Go to grabcad.com, and use the search bar to search for this shape. It may take a few attempts, because the naming of many components are not standardised or using. The barrel connector can be referred to as “DC power plug” or “DC power supply connector” or “EJ5035 connector”, etc. After a few attempts, I found the exact shape I was looking for. You can also find it at https://grabcad.com/library/ej503b-connector-1. | + | |
- | Once you found the shape you need, look for the downloadable file with the “.stp“ extension. An .stp file, pronounced “STEP”, is a commonly use data exchange format for representing 3D objects. The 3D viewer in KiCad can work with this file format. | + | |
- | Figure 57.2: The .stp file contains the data for our 3D shape | + | |
- | Download the EJ503B-ND.stp file. I save it in a 3D shapes folder in my | + | |
- | project directory, so it is easy to find later. | + | |
- | Next, start Pcbnew if not already started. Hover your mouse over the | + | |
- | barrel connector footprint, and bring up the footprint properties window by | + | |
- | pressing the “E” key (or right click to get the context menu, and select Properties). | + | 图57.7:管状连接器3D形状出现在PCB 3D查看器中。 |
- | In the Properties window, click on the 3D Settings tab. | + | |
- | Before we assign a new 3D shape, delete the existing one by selecting | + | 好多了,不是吗? |
- | the only row in the 3D Models pane, and clicking on the rubbish bin button. Even though there is an assignment, this specific wrl file does not exist on my computer. | + | |
- | Let’s add the new 3D shape. Click on the folder button right under the 3D Models pane, and navigate your file system to the location where you saved the STP file earlier. Click on the STP file, and the viewer will show the 3D shape in the right pane. | + | |
- | Figure 57.4: We’ll select this 3D shape; its preview confirms this is the model I need. Click OK to accept this selection, and you’ll go back to the Footprint | + | 这里还有一个没有3D形状的封装 - 滑动开关。我们也可以在grabcad.com上找到这个封装的形状。[[https:// grabcad.com/library/small-slide-switch-1|small-slide-switch-1]]或搜索“small slide switch”。按照完全相同的过程将滑动开关占用空间与此形状关联起来。为了使形状适合,我还必须调整x尺度值。 |
- | Properties window. As you can see, the 3D shape is not visible in the preview, but it is not in its correct place. | + | |
- | Figure 57.5: The new 3D shape is part of the model, but it is out of place. | + | 图57.8:PCB 3D查看器中出现滑动开关3D形状。 |
- | Now, we must manually position the 3D shape over the PCB in the way | + | |
- | we want it to appear in the final board rendering. Use the Scale, Rotation and Offset controls to do that. With a bit of effort, the final 3D model for this footprint will look like this: | + | |
- | Figure 57.6: The new 3D shape is part of the model, but it is out of place. Be sure to inspect the model from various angles to make sure | + | |
- | everything is aligned. Also look at it from the bottom to ensure that the pins and the holes are aligned. When the alignment is complete, click on “Ok” to commit the changes. | + | |
- | Let’s have a look at the 3D rendering of the full PCB. Bring up the 3D viewer. It should look like this: | + | |
- | Figure 57.7: The barrel connector 3D shape appears in the PCB 3D viewer. Much better, ins’t it? | + | |
- | There one more footprint without a 3D shape, the slide switch. You can find a shape for this footprint also in grabcad.com. Go to this page: https:// grabcad.com/library/small-slide-switch-1, or search for “small slide switch”. Follow the exact same process to associate the slide switch footprint with this shape. To make the shape fit well, I also had to adjust the X-scale value. | + | |
- | Figure 57.8: The slide switch 3D shape appears in the PCB 3D viewer. | + | 单击“确定”提交这些更改,并调出3D查看器 |
- | Click OK to commit these changes, and bring up the 3D viewer for the | + | |
- | PCB. | + | |
- | Figure 57.9: The completed PCB, rendered in the 3D viewer, with all component models. | ||
- | This is much better. All of the footprints now have their 3D shapes appearing in the 3D rendering of the PCB. For most footprints, you should have no trouble finding an existing 3D shape that can fit your footprint perfectly after a small amount of tweaking its position and scale. | ||
+ | 图57.9:完成的PCB,在3D查看器中渲染,包含所有元器件模型。 | ||
- | ### 3D模型的关联 | + | 这个好多了。所有的封装现在都有它们的3D形状出现在PCB的3D渲染中。对于大多数封装,我们都应该不难找到一个现有的3D形状,通过简单的位置、比例、旋转方向的调整,完美地适配我们的封装。 |