Keeping the same area within a rectangle when dragging either the X or Y side

Keeping the same area within a rectangle when dragging either the X or Y side

johnlagasse
Contributor Contributor
344 Views
4 Replies
Message 1 of 5

Keeping the same area within a rectangle when dragging either the X or Y side

johnlagasse
Contributor
Contributor

I want to make a 1 acre (43560SF) rectangle with one side 100 feet long and the other 435.6 feet long. If I grab a node and drag either the X or Y side, I want the other side to automatically change so the rectangle stays 1 acre in area. Not sure if it's even possible. 

0 Likes
345 Views
4 Replies
Replies (4)
Message 2 of 5

pendean
Community Legend
Community Legend

@johnlagasse You need to activate and use parametric constraints in AutoCAD : HELP in the program can give you an overview to get started.

 

pendean_0-1679518141159.png

 

0 Likes
Message 3 of 5

ronjonp
Mentor
Mentor

Not exactly what you're asking for but this code will easily help you keep the correct area.

 

(defun c:scaletoarea (/ _getarea a a2 ll o s ur)
  ;; RJP » 2020-06-30
  (defun _getarea (e / a)
    (if	(vl-catch-all-error-p (setq a (vl-catch-all-apply 'vlax-curve-getarea (list e))))
      0
      a
    )
  )
  (if (and (setq s (ssget ":L" '((0 . "~INSERT")))) (setq a (getreal "\nEnter desired area: ")))
    (foreach e (vl-remove-if 'listp (mapcar 'cadr (ssnamex s)))
      (if (/= 0 (setq a2 (_getarea e)))
	(progn (vla-getboundingbox (setq o (vlax-ename->vla-object e)) 'll 'ur)
	       (setq ll (mapcar '+ (vlax-safearray->list ll) (vlax-safearray->list ur)))
	       (vlax-invoke o 'scaleentity (mapcar '/ ll '(2 2 2)) (sqrt (/ a a2)))
	)
      )
    )
  )
  (princ)
)

 

0 Likes
Message 4 of 5

leeminardi
Mentor
Mentor

Attached is an example of using the Parametric modeling features of AutoCAD to address your task.  Note that you cannot have a parametric model that has a dimension as the function of another variable and that variable is a function of the original variable. This is a circular reference.  In other words, the "x" dimension cannot reference the "y" dimension if the "Y" dimension reference the "X" dimension.

 

In the example below the vertical dimension d2 is reference by the horizontal dimension d1.  The d1 dimension is a function of the area/d2.  You can change the value (double click) of d2 and d1 is automatically updated.  I added the dimension d3.  It is a "reference" dimension as indicated by the fact that it is in parentheses. It shows the result of the 43560/d2 calculation.

 

 

 

lee.minardi
0 Likes
Message 5 of 5

handjonathan
Autodesk
Autodesk

Hi @johnlagasse 

Thanks a lot for posting your question to the forums!   @kristina.youngblut hosted a Community Conversation on this topic yesterday; We will be sharing of the recording session here shortly. 

 



Jonathan Hand


Technical Marketing Manager | Construction

0 Likes