- 易迪拓培训,专注于微波、射频、天线设计工程师的培养
HFSS15: Creating a User Defined Primitive
The modeler allows you to generate user-defined primitives, primitives customized to suit any application. User-defined primitives are accessed using DLLs that you build and compile. When user defined primitives exist in your UserLib or Personal directory (given the paths specified in Tools>General Options Project Options tab), they appear in the Draw>User Defined Primitives> menu.. Newly created UDPs will appear after a restart, or Draw>User Defined Primitive>Update Menu.
The modeler includes example C++ source and header files that can be used to generate DLLs. The files are located in the UserDefinedPrimitives/Examples subdirectory under the hfss13 directory.
As an example, create the primitive myUDP.dll using Microsoft Visual C++ Developer Studio:
1. Create a directory to store all of the workspace information, call it UDPDir.
2. Use the sample workspace RectangularSpiral.dsw as a template:
a. Copy RectangularSpiral.dsw and RectangularSpiral.dsp from the UserDefinedPrimitives/Examples directory to this new directory.
b. Make sure the new files have write permissions.
c. Rename the files to myUDP.dsw and myUDP.dsp respectively.
d. Open the .dsw and .dsp files in a text editor, and replace every occurrence of RectangularSpiral with myDLL.
e. Save myUDP.dsp and myUDP.dsw.
3. In the UDPDir directory, create a Headers subdirectory.
4. Copy the UserDefinedPrimitiveStructures.h and UserDefinedPrimitiveDLLInclude.h files from the UserDefinedPrimitives/Headers directory.
Note | The header files include information on the methods that are available for use in your source code. They must be included when you compile the DLL. |
5. In the UDPDir directory, create a Source subdirectory.
6. Use the sample source file RectangularSpiral.cpp as a template:
a. Copy RectangularSpiral.cpp from the UserDefinedPrimitives/Examples directory to this new directory.
b. Make sure the new file has write permission.
c. Rename the file to myUDP.cpp.

7. Open myUDP.dsw using Microsoft Visual C++ Developer Studio, and edit the source code to create your desired primitive. You may also add additional headers and source files as appropriate.
The UDP dll contains a data structure called UDPPrimitiveTypeInfo. This contains information about the udp, its purpose, company/author who created it, date created and the version number. When you select a primitive from your library, you see the Create Primitive dialog with a Parameters tab for setting the parameters, and an Info tab with the information from this data structure.
8. Build myUDP.dll using the Win32 Release configuration.
9. Copy the resulting file myUDP.dll to the hfss14/userlib/UserDefinedPrimitives directory or the hfss14/personallib/UserDefinedPrimitives directory.
10. To view your primitives, click Draw>User Defined Primitive>Update Menu and then click Draw>User Defined Primitive>.
Note | On UNIX, you may use the same example directory structure, source, and header files to build and compile a shared library using C++. The resulting shared library will have a .so extension for Solaris and a .sl extension for HP-UX, and needs to be placed in the same hfss14/userlib/UserDefinedPrimitives directory. As with the Windows DLL, the compiled library will work only on the operating system on which it was built. |
HFSS 学习培训课程套装,专家讲解,视频教学,帮助您全面系统地学习掌握HFSS
上一篇:Creating an Object List
下一篇:Creating an Offset and Rotated Relative CS


