2D : Rectangle (?)

13»

Comments

  • RSW
    RSW
    edited May 30

    There is a way to edit the rectangles dimensions while keeping it a rectangle.

    1. Draw a rectangle of e.g. 100x50, you can even rotate it at an angle afterwards if you want.
    2. Grab the mid point of a side and start dragging it which will invoke the stretch command
    3. Select the base point option and select the mid point you selected at point 2.
    4. Drag it into the direction in which you want the dimension to change
    5. Type in the distance of change (e.g. 30) and hit enter

    The rectangle should now have changed its dimension with e.g. 30 as in the example above and the dimension should now be 30 larger or smaller in that direction depending on whether you dragged outward or inward respectively.
    It doesn't matter whether the rectangle is horizontal, vertical or at an angle, as long as you use the mid point of its side(s) it should work and keep it as a rectangle at the same angle.

  • The next request is Polygon click and change number of sides. 3 min.

    Another asked else where is a "donut" it does not exist its a pline, ps ate it.

  • @Anthony Apostolaros said:
    .... The user would start by picking a corner of a rectangle, and the function would then check to make sure the pick found a vertex of a polyline with 4 right angles. If so, it would start rubber-banding a rectangle using the opposite corner of the selected polyline as the base point. After a second pick point, the function would move three of the vertices so that the selected polyline is now a rectangle defined by the rubber-banding.

    Creating that custom command would take me too long, but here's a crude alternative. Instead of picking the corner you want to stretch, you pick the opposite corner -- i.e. the base point of the rubber-banding. This command doesn't really edit the selected rectangle. Instead, it draws a new rectangle to replace it, and gives that new rectangle the properties of the old one. It doesn't check to make sure the old rectangle was in fact a rectangle, or even a polyline, and it doesn't make sure that a corner point was picked as the base point. The user has to do all that. Also, because it creates a new entity and deletes the old one, it can cause problems with draworder, hatches, and dimensions. And of course it only works on rectangles that are aligned with the UCS.
    (defun c:RE () (sssetfirst nil nil) (setq DotPair (entsel "Select rectangle at Base point")) (setq OldRect (car DotPair)) (setq BasePoint (cadr DotPair)) (command "RECTANG" BasePoint) (while (> (getvar "cmdactive") 0) (command pause)) (setq NewRect (entlast)) (command "matchprop" OldRect NewRect "") (entdel OldRect) )

  • Another problem with the crude version above is that it can only select the newest entity at the pick point. This one is just as crude, but it accepts the entity selection and the base point pick separately. So it lets you select something that's not the newest entity at the base point. But this one requires 3 clicks instead of 2.
    (defun c:RE () (sssetfirst nil nil) (setq DotPair (entsel "Select rectangle to stretch")) (setq OldRect (car DotPair)) (setq BasePoint (getpoint "Select base point for stretch")) (command "RECTANG" BasePoint) (while (> (getvar "cmdactive") 0) (command pause)) (setq NewRect (entlast)) (command "matchprop" OldRect NewRect "") (entdel OldRect) )

  • This version allows pre-selection of the rectangle to be stretched. I like to pre-select everything.
    (defun c:RE () (princ "Select rectangle to stretch: ") (setq set1 (ssget "+.:E:S")) ; "+.:E:S" selects only one entity, by pick point only; allows pre-selection (sssetfirst nil set1) (setq OldRect (ssname set1 0)) ;sets OldRect = ename of the first (0th) entity in selection set set1 (setq BasePoint (getpoint "Select base point for stretch: ")) (command "RECTANG" BasePoint) (while (> (getvar "cmdactive") 0) (command pause)) (setq NewRect (entlast)) (command "matchprop" OldRect NewRect "") (entdel OldRect) )

  • ALANH
    edited June 1

    If you pick any of the 4 corners can work out which vertice it is so only be one pick required ? Can reorder a list of the points based on this point as 1st point of rectang. if want new size why not pop dcl with length and width or the value could be +50 so add to that side. Sneaky suspicion has been done.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!