<< Click to Display Table of Contents >> Add AutoCAD/AutoLISP command |
This chapter describes how you can add AutoCAD Commands or add AutoLISP code to the SymbolsPalette.
Enable Edit Mode first (see Edit Mode). To add an AutoCAD/AutoLISP Command you first must create a Custom Class. In this example you can see the folder Command with the two sub-folders AutoCAD and AutoLISP. To create an AutoCAD/AutoLISP Command you make a right-click on a Custom Class. If AutoCAD Plant 3D was started you will see Add New Custom Object... in the context menu of the Custom Class. After that you select Add AutoCAD command or AutoLISP.... If you have added a AutoCAD command or AutoLISP before and use the context menu again, you will see, that Add AutoCAD command or AutoLISP... is shown already in the context menu where you can click on without the need of going to the sub context menu. If you have added a Hyperlink before and use the context menu again, you will see, that Add Hyperlink is shown in the context menu. Here you have to go then to Add AutoCAD command or AutoLISP.... All these variations should help you to work a bit faster when adding one AutoCAD/AutoLISP Command after the other. You can also make a right-click on right side of the SymbolsPalette to add an AutoCAD/AutoLISP Command. The context menu on this side is also adapting depending on your previous selection. In any case, the Add New Custom Object dialog opens. In the Command or AutoLISP field you now type in your AutoCAD command. The example below shows the LINE command. ^C^C means, that a previous command will be canceled. Since a command can also be a transparent command (e.g. using the Zoom command within a Line command) you should always use ^C twice. The _ means, that the following command will be in English. This way, the command can be executed in any AutoCAD language version. The dot will execute the command even if the command was deleted (using UNDEFINE). As always you can edit the Display Name. Below the Display name you can limit the command to certain types of drawing. All allows you to use the command in any type of AutoCAD drawing. Alternatively, you can select P&ID and/or Plant 3D if the command should be available in P&ID and/or Plant 3D only. Under General Properties you can select the various AutoCAD properties. Under Color you can select the standard AutoCAD colors. At the button you can select Select Color... to have more options. You will be shown the common AutoCAD color selection dialog. Under Layer you can select a Layer from the current drawing you are in. The Layer settings like color, line type and so on, will also be stored, so the layer can be created in another drawing if the layer doesn't exist. Under Linetype you can also choose the line types of the current drawings. As with the layer settings, the line type settings will also be stored in order to create the same line type in a drawing in case the line type doesn't exist yet. If you select Other... you will be shown the standard AutoCAD dialog where you can also load line types which aren't available yet. Under Linetype scale you can enter a line type scale factor. Under Lineweight you can select the line weight you want to use. under Transparency you have the choice between ByLayer Transparency and Transparency Value. With Transparency Value you can then use the slider to select a value between 0 and 100%. When using ByLayer Transparency... ... the transparency will be used from the layer. Under Text style you can select the text style from the style which exist in the current drawing. In this example with the Line command it doesn't make sense. The same is true for Dimension style. Add the end you see a new Custom Object with the default image for AutoCAD commands. At the end of the process disable the Edit Mode again (see Edit Mode). |
Enable Edit Mode first (see Edit Mode). Adding AutoLISP Command works as adding an AutoCAD Command. You use again Add AutoCAD command or AutoLISP.... In the Command or AutoLISP you fill out your AutoLISP function. The example below creates a function PROCESSLINE with (defun C:PROCESSLINE()(command "SLINE" "S" "Primary Style" (getpoint) "N")). This function will execute the AutoCAD Plant 3D SLINE command and sets the Primary Style. The PROCESSLINE function will be executed with PROCESSLINE at the end. Remark: This chapter doesn't explain the details of creating AutoLISP function. However, it is the same procedure as using AutoCAD Toolpalettes. Since this function is using the SLINE command it makes sense to limit this function to P&ID for the drawing type. Also give it a descriptive Display Name. Setting the General Properties doesn't make sense when using the SLINE command, because the AutoCAD Plant 3D project Setup will determine the General Properties. Now the new Custom Object is shown. If you want to integrate such a command in the class structure of the Pipe Line Segments, then create a Custom Class under Pipe Line Segments. Now you create the function for this class. Again, you have the Custom Object under the Custom Class. And when you select a parent class like Pipe Line Segments you see the Custom Object integrated in the P&ID classes. At the end of the process disable the Edit Mode again (see Edit Mode). Remark: You can also use out AutoLISP variables and functions (see Functions for AutoLISP). |
Add AutoCAD Command from Tool Palette
Enable Edit Mode first (see Edit Mode). You can also add AutoCAD Commands from existing Tool Palettes. This may help to have a faster transition from using Tool Palette to using the SymbolsPalette. You can start the function from the context menu of a Custom Class... ... or by using the context menu on the right side of the SymbolsPalette and select Add From Tool Palette. Next a dialog with the available Tool Palettes will open, where you can select the Commands you want to copy to the SymbolsPalette. After clicking OK, you will see the Commands on the selected Custom Class. If you use Properties to edit the commands you will see the standard dialog of the SymbolsPalette with the command and the images. At the end of the process disable the Edit Mode again (see Edit Mode). |
Enable Edit Mode first (see Edit Mode). To edit an AutoCAD/AutoLISP command, you use the context menu of the Custom Object. This opens the Edit Custom Object dialog allowing you to make your changes. At the end of the process disable the Edit Mode again (see Edit Mode). |
Remove AutoCAD/AutoLISP Command
Enable Edit Mode first (see Edit Mode). To remove Custom Objects you also use the context menu and select Remove Custom Object. At the end of the process disable the Edit Mode again (see Edit Mode). |
To execute an AutoCAD/AutoLISP command you simple click on it. Since we didn't limit the Line command to any particular drawing type, we can start drawing the line with the defined General Properties. When we click on the Process Line icon, but the drawing is not of the P&ID drawing type... ... you will be shown the following dialog. If you are in a P&ID drawing, the function PROCESSLINE will be executed.
|
Next Chapter: Hide/Show Custom Classes