Jump to content

Recommended Posts

Posted (edited)

 

test20220429185443.thumb.png.95fa3a552174cabfdb1e0615a23b72ab.png

 

Hello everyone, when I select an arc in the drawing and modify its radius, the lines or arcs associated with the arc will change accordingly. This seems to require the use of a reactor. Unfortunately, I don't have any experience in this area at present. Knowledge. So I am looking for help here and hope to find a solution.

 

test20220429.dwg

Edited by ekko
Posted

What version of AutoCAD are you using? AutoCAD has had Parametric constraints available in it since Version 2010.

Posted
26 minutes ago, pkenewell said:

What version of AutoCAD are you using? AutoCAD has had Parametric constraints available in it since Version 2010.

The version I am using is AutoCAD2010, will this affect the use of

Posted (edited)
1 hour ago, ekko said:

The version I am using is AutoCAD2010, will this affect the use of

If you add parametric constraints to the geometry, then it will become "smart" geometry that will update depending on how you apply them.  I suggest you look in the help of AutoCAD on "Parametric Constraints".

 

Here is a video explaining them:

 

Edited by pkenewell
  • Thanks 1
Posted

Also google dynamic door block there are some good examples by regulars here.

  • Thanks 1
Posted (edited)
16 hours ago, pkenewell said:

If you add parametric constraints to the geometry, then it will become "smart" geometry that will update depending on how you apply them.  I suggest you look in the help of AutoCAD on "Parametric Constraints".

 

 

 

2022040565676.thumb.gif.65f0d4b8bc718a6141cd80e6fffad783.gif

 

(defun c:vv (/ os ss ent_date p1 p2 nent nent1)
  (setvar "cmdecho" 0)
  (setq os (getvar "osmode"))
  (setvar "osmode" 0)
  (princ "\nSelect Constraint Entities:")
  (setq ss (ssget))
  (setq	ent_date (entget (car (entsel "\nselect arc:")))
	p1	 (cdr (assoc 10 ent_date))
  )
  (command "_AutoConstrain" ss "")
  (setq p2 (mapcar '+ (list 425 425 0) p1))
  (setq nent (subst (cons 40 200) (assoc 40 ent_date) ent_date))
  (entmod nent)
  (setq nent1 (subst (cons 10 p2) (assoc 10 nent) nent))
  (entmod nent1)
  (command "_DelConstraint" ss "")
  (setvar "osmode" os)
  (setvar "cmdecho" 1)
  (princ)
)

I chose simple code and drawings for testing, so that it can get results quickly, obviously this does not achieve my needs

Edited by ekko
Posted (edited)
4 hours ago, BIGAL said:

Also google dynamic door block there are some good examples by regulars here.

According to your tips, find related videos on google. My requirement is to use code to operate and implement by selecting entities in the set. If you follow the method you suggested, you may need to go through a lot of judgment, which seems to be difficult to achieve. I am looking for a simple way, which requires the experience and guidance of the big guys.

Edited by ekko
Posted
1 hour ago, BIGAL said:

What is hard about

image.png.ab500a283ee17cfac88235f526ddbae4.png

I mean it's hard to modify the function of the above drawing by code, not search for tutorials of dynamic door block cadtutor

Posted
On 4/30/2022 at 12:28 PM, BIGAL said:

Also google dynamic door block there are some good examples by regulars here.

20220503164244.png.de2332764183b8b8eebfa12c4b244d5e.png

 

 

How can I get this set data, I try
(getvar "_AutoConstrain") but fails, the return value is nil

Posted
15 hours ago, ekko said:

20220503164244.png.de2332764183b8b8eebfa12c4b244d5e.png

 

 

How can I get this set data, I try
(getvar "_AutoConstrain") but fails, the return value is nil

 

http://www.lee-mac.com/dynamicblockfunctions.html

first you can get dynamic blocks properties list by lee mac's solution

like this

; http://www.lee-mac.com/dynamicblockfunctions.html

(vl-load-com)
(defun c:getdynprops ( / ss ssl index ename obj dynblkprops)
  (setq ss (ssget))
  (setq ssl (sslength ss))
  (setq index 0)
  (repeat ssl
    (setq ename (ssname ss index))
    (setq obj (vlax-ename->vla-object ename))
    (setq dynblkprops (LM:getdynprops obj))
    (princ dynblkprops)
    (setq index (+ index 1))
  );end of repeat
(princ)
);end of defun

;; Get Dynamic Block Properties  -  Lee Mac
;; Returns an association list of Dynamic Block properties & values.
;; blk - [vla] VLA Dynamic Block Reference object
;; Returns: [lst] Association list of ((<prop> . <value>) ... )

(defun LM:getdynprops ( blk )
    (mapcar '(lambda ( x ) (cons (vla-get-propertyname x) (vlax-get x 'value)))
        (vlax-invoke blk 'getdynamicblockproperties)
    )
)

 

and also get 1 property (your target value)

and also set that by Lee mac's modules

 

 

  • Thanks 1
Posted (edited)
4 hours ago, exceed said:

 

http://www.lee-mac.com/dynamicblockfunctions.html

first you can get dynamic blocks properties list by lee mac's solution

like this

 

and also get 1 property (your target value)

and also set that by Lee mac's modules

 

 

 

 

20220405656761.thumb.gif.4d5415ae9b10c123c948b995b2f35382.gif

 

I'm sorry for not explaining the problem, the dynamic block properties are not what I want, I just want to get the properties of the automatic constraints that I set, it is similar to (getvar "osmode") to get the object snaps set by the user, but I use (getvar "_AutoConstrain") it doesn't work,In other words, I want to set options for AutoConstrain via code, thanks for the effort my bro

Edited by ekko

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...