Author Topic: AutoCAD Formula  (Read 1051 times)

0 Members and 1 Guest are viewing this topic.


  • Newt
  • Posts: 44
AutoCAD Formula
« on: September 04, 2019, 11:37:01 AM »
While this is not an autolisp question, I know this group comes up with great autocad solutions so I figured it was worth a shot.
Has anyone worked with formulas in autocad blocks.  I am curious how to write a formula that can output a number based on the selected blocks visibility state names
Below are the variable formulas for the three blocks I want to reference, and there outputs are contact, motion detector, contact

%<\AcObjProp Object(%<\_ObjId 1960104872240>%).Parameter(7).VisibilityState>%
%<\AcObjProp Object(%<\_ObjId 1960104872432>%).Parameter(7).VisibilityState>%
%<\AcObjProp Object(%<\_ObjId 1960104872816>%).Parameter(7).VisibilityState>%

So "A" being contact and motion detector being "B", I am shooting for two formulas one that outputs 2 for A and one that outputs 1 for B

I am aware how I could create and process a list in several other languages, just not sure for block formulas.  If a similar formula is not available, any references to this language that go further than base equations (If possible) would be greatly appreciated.


  • Needs a day job
  • Posts: 7125
Re: AutoCAD Formula
« Reply #1 on: September 04, 2019, 02:20:13 PM »
You could use a lookup table and and attribute like so. Although I'm not sure if this is exactly what you're asking.

Windows 10 x64 - AutoCAD /C3D 2020

Custom Build PC


  • Water Moccasin
  • Posts: 2415
  • I can't remeber what I already asked! I need help!
Re: AutoCAD Formula
« Reply #2 on: September 05, 2019, 01:25:31 PM »
Pretty cool job.
Autodesk Infrastructure Design Suite 2019


  • Newt
  • Posts: 44
Re: AutoCAD Formula
« Reply #3 on: September 12, 2019, 09:40:20 AM »
Great suggestion though in my case not sure this would work as I have 20 blocks with two visibility states that are needing to be referenced.
so unfortunately that would be 2^20 = 1048576 different states.  That is why I am trying to learn the not really want to but it seems like that is the viable solution in my case.