How To Do
ShowRubberBandEntities method
ShowRubberBandEntities is a method of DXFReaderNETControl that displays a “rubber band” preview for a list of entities. In CAD/viewer terminology, a rubber band is a temporary, interactive drawing overlay used to preview something while the user is still interacting (e.g., dragging with the mouse), before you actually commit changes to the drawing/model. (dxfreader.net)
What it does
Signature (C#)
public void ShowRubberBandEntities(
List<EntityObject> Entities,
Vector2? Position = null
)
Parameters explained
Entities (required)
Typical content could be one or more geometric objects (lines, polylines, arcs, inserts, etc.) represented as EntityObject instances.
Position (optional)
-
Type: Vector2? (nullable)
-
Meaning: new position of entities (i.e., where the entities should be shown during the preview).
Because it’s nullable, you have two modes:
-
Position == null: show the rubber band for the given entities “as is” (preview without relocating them).
-
Position != null: show the same entities previewed at a new position, which is commonly used for “drag move” or “place object” interactions.
Typical interaction flow (how it’s used in an app)
A common usage pattern looks like this:
-
User starts an action (e.g., mouse down on a selection)
-
User moves the mouse
-
You compute the target position in world coordinates (usually via a pixel→world conversion offered by the control).
-
You call ShowRubberBandEntities(entities, currentPosition) repeatedly while the mouse moves.
-
The control redraws the rubber-band overlay so the user sees the objects “following” the cursor.
-
User ends the action (mouse up)
-
You commit the transformation (apply the move/placement to the actual entities in your model / DXF document).
-
You typically trigger a refresh/regeneration of the main drawing view (depending on the control’s workflow), and stop showing the rubber band.
This method is about visual feedback: it is designed to show a temporary preview; the actual “real” geometry change (move/transform) is usually done by your code when the interaction is confirmed.
RubberBandType Enumeration
The enum values and their documented behavior are:
-
Dashed (0)
Draw rubber band dashed.
-
Solid (1)
Draw rubber band solid.
-
CurrentColor (2)
Draw rubber band solid using the current color.
-
EntityColor (3)
Draw rubber band solid using each entity’s own color.
-
Dot (4)
Draw rubber band dotted.
The purpose of this enum is to control how the rubber band looks, so you can choose:
-
a clearly “temporary” appearance (dashed/dotted), or
-
a more “realistic” preview matching either the control’s current drawing color or each entity’s color.