TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: mbrandt5 on September 04, 2019, 11:37:01 AM

Title: AutoCAD Formula
Post by: mbrandt5 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.
Title: Re: AutoCAD Formula
Post by: ronjonp 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.
Title: Re: AutoCAD Formula
Post by: MSTG007 on September 05, 2019, 01:25:31 PM
Pretty cool job.
Title: Re: AutoCAD Formula
Post by: mbrandt5 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 code...do not really want to but it seems like that is the viable solution in my case.