Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Visibility inside Block Editor

7 REPLIES 7
SOLVED
Reply
Message 1 of 8
dgenesse
700 Views, 7 Replies

Visibility inside Block Editor

Hi All, I am creating blocks with AutoLISP that have several parameters including visibility. I have everything working except that I need the visibility to be displayed in an attribute. Creating the attribute is done, but when I try to get the field for the visibility to use in the attribute, it does not work. I can get the field manually which is %<\AcObjProp.16.2 Object(?BlockRefId).Parameter(1).VisibilityState \f "%tc1">% For simplicity, I have arranged the program such that the visibility is the first parameter created, therefore it will always be parameter 1. Every variation of the field code that I have tried does not work. In case you are wondering, there is a reason why I am creating the blocks with AutoLISP. The blocks require several items placed at varying spacings depending on the size of a polyline outline.
7 REPLIES 7
Message 2 of 8
Gary_J_Orr
in reply to: dgenesse

works on 2012 with OTB dynblock at least:

 

dyn_block_VisPar_Field.JPG

 

I did have to ensure that the field attribute was visible in all visibility states but everything was pretty straightforward otherwise.

 

-Gary

Gary J. Orr
(Your Friendly Neighborhood) CADD/BIM/VDC Applications Manager
http://www.linkedin.com/in/garyorr

aka (current and past user names):
Gary_J_Orr (GOMO Stuff 2008-Present); OrrG (Forum Studio 2005-2008); Gary J. Orr (LHB Inc 2002-2005); Orr, Gary J. (Gossen Livingston 1997-2002)
Message 3 of 8
dgenesse
in reply to: Gary_J_Orr

Hi Gary, That's the result that I want, but I need the AutoLISP to work in my program. Making sure what was visible when in the program took a bit of trial and error to get it right.
Message 4 of 8
Gary_J_Orr
in reply to: dgenesse

going to need specific examples to go any further...
I don't know what your routine looks like that is creating the block, I don't have examples of a drawing file to examine the block after it has been defined and inserted, no graphics of what it may look like on your end, etc...
So, at this point, my only suggestion is to verify that the attribute is visible in all of the visibility states (if it isn't visible in each state then changing the VB state will remove the value from the properties of the currently visible state once modified)
-G
Gary J. Orr
(Your Friendly Neighborhood) CADD/BIM/VDC Applications Manager
http://www.linkedin.com/in/garyorr

aka (current and past user names):
Gary_J_Orr (GOMO Stuff 2008-Present); OrrG (Forum Studio 2005-2008); Gary J. Orr (LHB Inc 2002-2005); Orr, Gary J. (Gossen Livingston 1997-2002)
Message 5 of 8
dgenesse
in reply to: Gary_J_Orr

Hi Gary,

 

My program works from inside the block editor.

 

Insert a visibility parameter. Create an attribute. Set the attribute to the field for the visibility parameter. Note that at this point, the block editor is still running. The block is not being inserted until after the program is completed.

 

The rest of program really just draws a few objects.

 

The issue is not making the attribute visible for a particular visibilty, but rather getting the proper field information to link the attribute to the visibility parameter.

Message 6 of 8
dgenesse
in reply to: dgenesse

Hi All,

 

Just to clarify, I am working on a subroutine in AutoLISP that works inside the Block editor.

 

The subroutine basically does the following:

 

(command "_.bparameter" "v" "l" "VISIBILITY" VIP "1") ; Insert a Visibility parameter at point VIP

 

;get information to create a field code similar to the manually inserted field - %<\AcObjProp.16.2 Object(?BlockRefId).Parameter(1).VisibilityState \f "%tc1">%

 

; set VISFIELDTEXT to the field for the visibility

 

(command "_.attdef" "a" "" "VISATTRIB" "Visibility_Attribute" VISFIELDTEXT "J" "MC" TIP "") ; insert an attirbute called VISATTRIB with the field VISFIELDTEXT at the point TIP

 

The problem is that the VISFIELDTEXT always gives an improper field. I cannot get the right information to build the field text properly.

 

 

Message 7 of 8
Gary_J_Orr
in reply to: dgenesse

well...

First, the utility that generates a field (the little "field" button in the dialog version of attdef) for a replacement value (which is truly what a field is) seems to be beyond reach via Vllisp (and DXF entity definition lists) and ActiveX (vla***) functions/properties (or beyond me in finding a way to reach them short of .NET)

Secondly, The values and codes are stored and accessed via extension dictionaries attached to the attribute via the said "unattainable" function and not within the "string value" of the attribute itself.

 

I can aquire the field via a couple of methods but ActiveX simply returns it as a generic object instead of the "field" object that is available in .NET.and I have yet to determine how the DXF entity list returned from the field definition ties the result to the object/property that it is reporting on... the returns from the field (which can be accessed via getting the "ACAD_FIELD" dictionary out of the attribute's extension dictionary, and then getting the "AcDbField" from within that (of one that was created by the dialog version).

 

The DXF codes are represented as: (1 . "_text") (2 . "%<\\_FldIdx 0>%")

 whereas the ActiveX return is:

; IAcadObject: The standard interface for a basic AutoCAD object
; Property values:
;   Application (RO) = #<VLA-OBJECT IAcadApplication 0171b450>
;   Document (RO) = #<VLA-OBJECT IAcadDocument 1330c08c>
;   Handle (RO) = "2422"
;   HasExtensionDictionary (RO) = 0
;   ObjectID (RO) = 2129725968
;   ObjectName (RO) = "AcDbField"
;   OwnerID (RO) = 2129725960
; Methods supported:
;   Delete ()
;   GetExtensionDictionary ()
;   GetXData (3)
;   SetXData (2)

 

So it seems that there may be some clues in the entity codes to gather data from an existing one but, all in all, I can't find any way to create one.

 

Sorry, maybe someone more creative than I can get you there, but I can't find a path to do so.

-Gary

Gary J. Orr
(Your Friendly Neighborhood) CADD/BIM/VDC Applications Manager
http://www.linkedin.com/in/garyorr

aka (current and past user names):
Gary_J_Orr (GOMO Stuff 2008-Present); OrrG (Forum Studio 2005-2008); Gary J. Orr (LHB Inc 2002-2005); Orr, Gary J. (Gossen Livingston 1997-2002)
Message 8 of 8
dgenesse
in reply to: Gary_J_Orr

So I found the solution and it comes down to sometimes the simplest answer is the one that works.

 

It turns out that inside the block editor you don't need the object id.

 

(command "_.bparameter" "v" "l" "VISIBILITY" VIP "1") ; Insert a Visibility parameter at point VIP

(setq VISFIELDTEXT (strcat "%<\\AcObjProp.16.2 Object(?BlockRefId).Parameter(1).VisibilityState \\f \"%tc1\">%")) ; set VISFIELDTEXT to the field for the visibility

(command "_.attdef" "a" "" "VISATTRIB" "Visibility_Attribute" VISFIELDTEXT "J" "MC" TIP "") ; insert an attirbute called VISATTRIB with the field VISFIELDTEXT at the point TIP

 

Notice that the Object uses Object(?BlockRefId) instead of an object id of a specific entity.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost