Transitioning from 2d to 3d autocad drawings

Sunday, May 10, 2009

AutoCAD 2010 Contextual Tab States 101

Please Click the Pic ,you can see Quality Photos

In a previous post, I described contextual ribbon tabs and I listed the default editing modes for which context-sensitive ribbon tabs are displayed including blocks, text, meshes, in-place references, section planes, and tables. The context-sensitive behavior is controlled by contextual tab states, which you can view and modify in the Customize User Interface (CUI) dialog box.

  1. Use the CUI command to access the Customize User Interface dialog box
  2. Expand the Ribbon node
  3. Expand the Contextual Tab States node

A long list of contextual tab states is displayed. Most of them relate to object selection (Arc selected, Attribute selected, Block selected). Others relate to editing modes (Block Editor Mode, Reference Editing Mode). The contextual tab states that are already defined can be expanded to show which tabs will display in those modes.

RibbonContextTabStates01


For example, the Block Editor Contextual Tab and the Block Editor – Close Contextual Merged Tab automatically displays when you enter the Block Editor.
RibbonContextTabStates02

The DGN Underlay Contextual Tab automatically displays when you select a DGN underlay.

RibbonContextTabStates03

While the contextual tab states indicate which tabs to display under what conditions, they do not define the tabs themselves. The tabs are defined, just as they’ve always been, under the Ribbon>Tabs node in the CUI editor.

Monday, March 16, 2009

Exploring the autolisp SSGET function - part 2


Ok, getting back to the last (ssget) call in part 1...

(ssget "_W"

(list 5.0 5.0)(list 8.0 8.0)
'((0 . "CIRCLE")(-4 . "<")(40 . 1.0))
)

The "_W" is the window selection method. Then we are passing it two points (5,5 and 8,8). Then we are telling it to only accept circle entities. The last two pieces tell it to only accept circles whose radius (DXF code 40) is less than 1.0.

So in summary, this bit of code will search the entire database and return only circles whose radius is less than 1.0 who also lie inside a polygon defined by the corners of 5,5 and 8,8.

The -4 group code is a special code that lets you perform relational testing. There are codes for equal, not equal, less than, less than or equal, greater than, greater than or equal, and two bitwise operators.

This type of filtering works great for locating entities on a certain layer, or that have a certain color or linetype.

(ssget "_X"

'((0 . "LINE")(8 . "TEMP"))
)

The code above will select all LINE entities on the TEMP layer.

(ssget "_X"

'((8 . "TEMP")(62 . 3))
)

The code above will select all entity types on the TEMP layer whose color is green (3). Be careful when filtering for color, linetype and lineweight. These filters only apply if the particular property is explicitly set. In the example above, if the color of all entities on the TEMP layer is set to BYLAYER, the selection set will be empty, even if the color of layer TEMP is green (3).


You can use wildcard matching in selection set filtering also.

(ssget "_X"

'((0 . "DIMENSION")(3 . "DIM##"))
)

The code above will select all dimensions whose dimstyle is DIM## (where the # represents a single numeral). For example, a dimension whose dimstyle is DIM55 or DIM39 will be selected. Dimensions with a dimstyle of DIM4T, DIM777, DIMKK, or DIM are not selected. Other wildcard syntax can be found under the (wcmatch) function in the Autolisp Reference Guide.

You may have figured it out by now, but "AND" is implied when when combining multiple filters such as above. In other words, in the above example, it's going to find entities that have the type dimension AND whose dimension style is DIM##. There may be cases were you want to specify "AND", especially if you are using an "OR" also.

(ssget "X"

'(
(-4 . " (-4 . " (0 . "CIRCLE")
(40 . 1.0)
(-4 . "AND<")
(-4 . " (0 . "LINE")
(8 . "ABC")
(-4 . "AND<")
(-4 . "OR<")
)
)

The code above is straight out of the Autolisp Developer's Guide. It creates a selection set out of CIRCLE entities that have a radius of exactly 1.0 and LINE entities on the ABC layer. If you did not use the "OR" condition, then the (ssget) function would be trying to find entities that are a CIRCLE and a LINE, which is obviously impossible. Let's look at one more example.

(ssget '((0 . "POLYLINE,LWPOLYLINE")(-4 . "&")(70 . 1)))


Last, but not least... The code above uses a "bitwise AND" to filter on a bit coded DXF code. In this case, DXF code 70 on a POLYLINE and/or LWPOLYLINE. The goal here is to create a selection set of closed polylines. If DXF code 70 has the "1" bit set, this indicates a closed polyline. However, we cannot simply filter for DXF code 70 = 1, because this is a bit coded field. If LTGEN is turned on and it's a closed polyline, then DXF code 70 will equal 129, not 1. This is why you must use the "&" (Bitwise AND) special filter.

There is much more information in the Autolisp Developer's Guide on advanced selection set handling. Good luck and post some of your examples in the comments section if you want.

  © Blogger template 'Perfection' by Ourblogtemplates.com 2008

Back to TOP