SolidWorks Express
CAD Tips for the week of January 18, 2010
 
Field Update Facts: Most fields will update automatically when you Save or Regen the drawing (this is controlled by the FIELDEVAL system variable) >>
Sticky Notes for AutoCAD: The (alert) function is used to prompt users to select OK when an AutoLISP routine is running. It’s generally used to gain assent before starting a process that may take a long time or can’t be undone >>
.NET Loss: AutoCAD 2010 and related products may crash when the Microsoft .Net Framework 3.5 Service Pack 1 is not installed properly >>
Dynamic Blocks - Chaining Parameters: The chaining feature in dynamic blocks allows you to have one action cause another action to occur. This is a general explanation of how chaining works >>
Dynamic Blocks - Keep Attribute Text Static: So you’ve created a nice dynamic block that you can rotate as needed. The problem now is that the block’s attribute text rotates right along with it >>
   
 
> Field Update Facts
   
 

Most fields will update automatically when you Save or Regen the drawing (this is controlled by the FIELDEVAL system variable).


Caption: To change FIELDEVAL settings, select the Field Update Settings button on the User Preferences tab of the Tools / Options dialog box. Then select when you want updates to take place in the Field Update Settings dialog box (below).

Sheet Set and Date fields behave differently, however. They are contextual, which means that their value varies depending on what space or layout they reside in. Contextual fields include:

  • CurrentSheetCustom
  • CurrentSheetTitle
  • CurrentSheetDescription
  • CurrentSheetNumber
  • CurrentSheetNumberAndTitle
  • CurrentSheetSet
  • CurrentSheetSetCustom
  • CurrentSheetSetDescription
  • CurrentSheetSubSet
  • DeviceName
  • PaperSize
  • PageSetupName
  • PlotDate
  • PlotOrientation
  • PlotScale
  • PlotStyleTable

Use the Updatefield command to update contextual fields.

Keep in mind that sheet set fields store the last values that were used, and they display these stored values if the information referenced by the sheet set field is not accessible. Contextual fields in blocks and xrefs are not updated when you insert them into a drawing; instead, they display their last stored value. Insert contextual fields as attributes so that they will display correctly when the block is inserted. If a value is not available, the field will display a string of pound signs (####).
   
 
> Sticky Notes for AutoCAD
   
 

The (alert) function is used to prompt users to select OK when an AutoLISP routine is running. It’s generally used to gain assent before starting a process that may take a long time or can’t be undone. You can use it for that purpose, but it also can be used directly at the command line to post reminders to yourself for when you return to your desk or leave messages for other users who have stepped away from their desks.

At the command line, type:

(alert “your message goes here”)

If you want to display multiple lines of a message, insert a \n (backslash n) where you want a line break.

   
 
> .NET Loss
   
 

AutoCAD 2010 and related products may crash when the Microsoft .Net Framework 3.5 Service Pack 1 is not installed properly. AutoCAD will start with no trouble, but crashes when you try to run a command or select an interface item. The crash is accompanied by this error message:

Unhandled e0434f4dh exception at 7c81eb33h

The cure is to download and install the Service Pack yourself. You can download it here:

http://www.microsoft.com/downloads/details.aspx?FamilyID=AB99342F-5D1A-413D-8319-81DA479AB0D7&displaylang=en

   
 
> Dynamic Blocks: Chaining Parameters
   
 

The chaining feature in dynamic blocks allows you to have one action cause another action to occur. This is a general explanation of how chaining works. In the future, we’ll look at some specific examples of how you might use this feature.

In some cases, you can assign two actions to a single parameter. When you use the parameter grip to modify the block, both actions will occur.

For more complex geometry you will need more than one parameter to get the results you want. In such cases, you need to activate the chaining feature, which is called Chain Actions in the Properties palette. In a typical chain you will have two actions and two parameters. The action assigned to parameter 1 will include parameter 2 in its selection set (if action 1 is a Stretch action, parameter 2 will need to be included in its stretch frame). Parameter 2 will have its own action assigned, and you will set its Chain Actions property to Yes.

With this setup, when you grip-edit the block using the grip for parameter 1, the action of parameter 2 is activated at the same time. 

As you can see, you will need to plan out how you want your action chain to work before you start slapping parameters and actions onto your block. First, decide which action is the main action (action 1 in the example above)—the one that will trigger the other action. Then determine what parameters you need and what their actions will be. In the Block Editor, first use the Block Authoring Palettes to add the parameters to your block. Create the main action and attach it to its parameter (parameter 1). When you specify the selection set for the main action, include parameter 2, the parameter for the second action. Note, though, that you don’t want to include the objects that are going to be in the selection set for parameter 2’s action. Finally, add the action for parameter 2 and set Chain Actions to Yes.

To help avoid confusion when you insert a block, you can remove the grips for parameter 2. Because its action is activated automatically, it doesn’t need any. In the Block Editor, select parameter 2, right-click, and set Grip Display to 0 (zero).

   
 
> Dynamic Blocks: Keep Attribute Text Static
   
 

So you’ve created a nice dynamic block that you can rotate as needed. The problem now is that the block’s attribute text rotates right along with it. Here’s how to keep a dynamic block’s attribute text horizontal so you can it read it no matter how you rotate the block. Open or create the block and its attributes in the Block Editor. Add a Rotate parameter from the Block Authoring Palettes. This will be the main parameter (parameter 1). Set the base point, radius, and angle as required.

Next, add a Point parameter (parameter 2) at the insertion point of the text. When you add it, set its grips to 0 and Chain Actions to Yes.


Caption: To keep the grip from displaying, select the parameter, right-click, and select 0 from the Grip Display flyout.

You can also enter these settings through the Properties palette. Add a Move action to the Point parameter (parameter 2). Select the text as its selection set.

Add a Rotate action to the Rotate parameter (parameter 1). When specifying its selection set, include both the geometry you want to rotate and the Point parameter. Do not include the text or the Move action. Save your block and close the Block Editor.


Caption: Block as it appears in Block Editor.

When you insert the block, you will be able to use the Rotate grip to rotate it, but the text will remain horizontal.

   
 
   
 
 
>> SIGN UP for SolidWorks Express Newsletter and get the tips and tricks delivered into your inbox every two weeks!