Author Topic: Get List Constraints  (Read 1951 times)

0 Members and 1 Guest are viewing this topic.

Lupo76

  • Bull Frog
  • Posts: 343
Get List Constraints
« on: November 15, 2017, 05:54:26 AM »
Hi everyone,
I need to make a lisp that allows me to rename the constraints included in the drawing using, for example, the DMCONCENTRIC3D command from BricsCAD.

Can you help me understand how to get the list of constraints and what lisp function do you use to rename them?
Unfortunately I have no idea where to start, so I need some starboard.

I hope in your help.

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: Get List Constraints
« Reply #1 on: November 15, 2017, 01:19:40 PM »
To get the names:
Start digging in the extension dictionary of the model space block.

To rename:
You can probably just call the -Parameters command.

Lupo76

  • Bull Frog
  • Posts: 343
Re: Get List Constraints
« Reply #2 on: November 16, 2017, 02:14:12 AM »
To get the names:
Start digging in the extension dictionary of the model space block.
What do you mean exactly? could you send me a few lines of code?

To rename:
You can probably just call the -Parameters command.

Perfect! this works!

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: Get List Constraints
« Reply #3 on: November 16, 2017, 03:30:53 AM »
Code - Auto/Visual Lisp: [Select]
  1. ; (ParamNameListGet (vla-get-activedocument (vlax-get-acad-object)))
  2. (defun ParamNameListGet (doc / enm)
  3.   (if
  4.     (and
  5.       (= :vlax-true (vla-get-hasextensiondictionary (vla-get-modelspace doc)))
  6.       (setq enm
  7.         (vle-dictobjname
  8.           (vlax-vla-object->ename (vla-getextensiondictionary (vla-get-modelspace doc)))
  9.           "ACAD_ASSOCNETWORK"
  10.         )
  11.       )
  12.       (setq enm (vle-dictobjname enm "ACAD_ASSOCNETWORK"))
  13.     )
  14.     (vl-remove
  15.       nil
  16.       (mapcar
  17.         '(lambda (sub)
  18.           (if
  19.             (and
  20.               (= 360 (car sub))
  21.               (= "ACDBASSOCVARIABLE" (vle-entget 0 (cdr sub)))
  22.             )
  23.             (vle-entget 1 (cdr sub))
  24.           )
  25.         )
  26.         (entget enm)
  27.       )
  28.     )
  29.   )
  30. )

Lupo76

  • Bull Frog
  • Posts: 343
Re: Get List Constraints
« Reply #4 on: November 16, 2017, 05:20:41 AM »
Initially, your code looked great, but later I noticed that many constraints are missing in the list (eg Fix, Coincident, and others).

I have tried to modify your code but unfortunately I did not succeed in my goal  :cry:

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: Get List Constraints
« Reply #5 on: November 16, 2017, 10:15:33 AM »
As far as I can tell these constraints without expressions are not exposed in the Lisp API.

The closest I think I can get:
Code: [Select]
> Extension dictionary of the model space object
  > BDM_DATABASE dictionary
    > BDMDBCONSTRAINTMANAGER entity
An entity list of a BDMDBCONSTRAINTMANAGER entity does not provide any further leads (the gc 330 ename points to the parent dictionary):
Code: [Select]
(
  (-1 . <Entity name: 53cc03f0>)
  (0 . "BDMDBCONSTRAINTMANAGER")
  (5 . "D3")
  (102 . "{ACAD_REACTORS")
  (330 . <Entity name: 53cc0c70>)
  (102 . "}")
  (330 . <Entity name: 53cc0c70>)
)

You can try sending in a Support Request.

Lupo76

  • Bull Frog
  • Posts: 343
Re: Get List Constraints
« Reply #6 on: November 16, 2017, 10:18:32 AM »
You can try sending in a Support Request.

Just made!
Thank you.