Equivalent to getpropertyvalue in accoreconsole

Equivalent to getpropertyvalue in accoreconsole

rdurland
Explorer Explorer
1,028 Views
8 Replies
Message 1 of 9

Equivalent to getpropertyvalue in accoreconsole

rdurland
Explorer
Explorer

Hello everyone,

 

I have written the same routine multiple times, each time roadblocked by this issue:

 

Nothing works in AcCoreConsole.exe.

 

For part of my routine, I need to retrieve a property from a series of dynamic blocks. Here is a (modified) chunk of my existing code:

 

(if some-bool
  (setq 
    name (LM:al-effectivename ent)      ;; Block's human-readable name
    data (list
      ent       ;; Entity
      (cond     ;; Convert the human-readable name to int
        ( (= name "NAMEFLY") 1 )
        ( (= name "NAMEPLZ") 1 )
        ( (= name "NAMEGUY") 2 )
        ( (= name "NAMEZZZ") 3 )
        ( T 0 ) ;; Default
      )
      (atoi (getpropertyvalue ent "AcDbDynBlockPropertyMyHeight")) ;; Height
    )
    mylist (append mylist (list data))
  )
)

 

*Credit to Lee Mac for LM:al-effectivename:

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

 

Please see line 13, where I read a property value from a dynamic block. This works find in Acad. Unfortunately, when running this routine in AcCoreConsole, I get the error "no function definition: GETPROPERTYVALUE". I speculate this to be due to getpropertyvalue relying on Visual Lisp somewhere, which AcCoreConsole does not support; in any case, it doesn't work.

 

I can't seem to find any documentation on obtaining this value without Visual Lisp. I do not have permission to edit this dynamic block (and I don't know how to, anyway).

 

I need help getting this value. The property I'm looking for corresponds to the block's height - if I have a way to measure its height (along the y axis) in model space, I can work off that. It is also the same as the visibility state, in case that helps. References to documentation, sample code, etcetera that can point me in the right direction are also appreciated.

0 Likes
Accepted solutions (1)
1,029 Views
8 Replies
Replies (8)
Message 2 of 9

Sea-Haven
Mentor
Mentor

My bricscad does not support get or put property, for Accoreconsole you will need to use dxf codes of the entity, eg layer (cdr (assoc 8 (entget ent)))

 

Accoreconsole may be able to use VL code have seen some comments about loading correct .ARX to use but never tested it.

0 Likes
Message 3 of 9

rdurland
Explorer
Explorer

Unfortunately, the value I need doesn't appear as one of the DXF codes for the entity. I've noticed an extension dictionary (code 360), however I'm unsure of how to explore that for values. Samples I've seen from other users don't ever touch it, so I'm assuming what I want isn't in there.

 

I've heard of using .ARX extensions to solve AcCoreConsole issues, however I'm not terribly excited to try and tackle that as a solution. I'll look into it further if it comes down to that, though.

 

Thank you for your advice.

0 Likes
Message 4 of 9

Sea-Haven
Mentor
Mentor

If VL works then use this to look at properties.

 

 

;;;===================================================================; 
;;; DumpIt                                                            ; 
;;;-------------------------------------------------------------------; 
;;; Dump all methods and properties for selected objects              ; 
;;;===================================================================; 
(defun C:Dumpit ( / ent) 
  (while (setq ent (entsel)) 
    (vlax-Dump-Object 
      (vlax-Ename->Vla-Object (car ent)) 
    ) 
  ) 
  (princ) 
)

 

 

 For dynamic blocks also want Lee-mac.com "dynamic block properties.lsp"

 

Google about getting 360 data and XDATA.

 

Maybe this Get layout tab list without using Active X? (theswamp.org)

 

 

0 Likes
Message 5 of 9

rdurland
Explorer
Explorer

Unfortunately, VL does not seem to work. With your Dumpit command I'm getting "error: no function definition: CLAX-ENAME->VLAOBJECT". I couldn't find any "dynamic block properties.lsp", but I did find Lee Mac's Dynamic block functions:

 

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

 

Using these, I got a slightly different error: "Unkown error: bad argument type: VLA-OBJECT nil"

 

I found this odd, and tested it further. Here's the code I used to test it, derived from my original code:

(if some-bool
      (progn
        (princ "\ntest\n")
        (princ (vlax-ename->vla-object ent))
        (princ "\nEnd test\n")
        (setq 
          name (LM:al-effectivename ent)      ;; Rack's human-readable name
          data (list
            ent       ;; Entity
            (cond     ;; Convert the human-readable name to int
              ( (= name "NAMEFLY") 1 )
              ( (= name "NAMEPLZ") 1 )
              ( (= name "NAMEGUY") 2 )
              ( (= name "NAMEZZZ") 3 )
              ( T 0 ) ;; Default
            )
            ;;(atoi (getpropertyvalue ent "AcDbDynBlockPropertyMyHeight")) ;; Height
            (atoi (LM:getvisibilitystate (vlax-ename->vla-object ent)))
          )
          mylist (append mylist (list data)
        )
      )
    )

This test code produces the output:

 

    test

 

    Unkown error: bad argument type: VLA-OBJECT nil

 

I find this extremely weird. For reference, running this same code in Autocad itself and not in AcCoreConsole, I get

 

    test

 

    #<VLA-OBJECT IAcadBlockReference 00000201313d0578>

 

    End test

 

This is the output I would expect, and the code functions perfectly fine. It seems that, when run in AcCoreConsole, the error occurs during the call to "vlax-ename->vla-object". Overall, though, it seems that VL won't work without help.

 

Based on the post you sent me, I believe I could get VL working by importing the correct files. I tried importing "vl16.tlb" (found via google) , but I ran into the same errors (same as if I didn't import it). If you happen to know the files where these functions / tools are all defined, please let me know, and I'll try importing them. For reference, I tried importing using "vlax-import-type-library", using a few different sets of prefixes.

 

I looked into XDATA and the 360 group code, and while XDATA won't help here, I believe I might be able to recover something from the 360 code, which is apparently a hard owner ID to a dictionary. I'll look into it further.

 

Thank you for your help.

0 Likes
Message 6 of 9

ronjonp
Mentor
Mentor
Accepted solution

@rdurland 

I'm not sure which ARX holds the get/setproperty but maybe you could load all of them like so in coreconsole:

 

(foreach file '("acapp.arx"		"acapp.crx"		"acautoloader.arx"
		"acautoloader.crx"	"acblock.crx"		"accmmgr.crx"
		"acconnectwebservices.arx"			"accoremgd.dll"
		"accounting.arx"	"accounting.crx"	"acdim.arx"
		"acdim.crx"		"acetutil.arx"		"acexperience.arx"
		"acfdui.arx"		"acgeomentobj.dbx"	"acgsconfig.arx"
		"acgsconfig.crx"	"acismobj24.dbx"	"acismui.crx"
		"acjscorestub.crx"	"acmapcoordsyscore.dbx"	"acmgd.dll"
		"acobjclassimp.arx"	"acocschemautil.arx"	"acopm.arx"
		"acopmext.arx"		"acpexctl.arx"		"acpi.arx"
		"acpublish.arx"		"acpublish.crx"		"acrevcloud.crx"
		"acsceneoe.dbx"		"acshareviewpropsaca.dbx"
		"acshareviewpropspe.dbx"			"acsign.arx"
		"acsmnav.arx"		"actable.arx"		"actable.crx"
		"actrace.crx"		"actraceui.arx"		"acvdiff.arx"
		"acvdiff.crx"		"acvmtools.arx"		"acvmtools.crx"
		"acxdiff.arx"		"acxdiff.crx"		"aecarchbase.dbx"
		"aecareacalculationbase.dbx"			"aecbase.dbx"
		"aecbaseex.dbx"		"aecbbldsrv.dbx"	"aecbcol.dbx"
		"aecbelecbase.dbx"	"aecbhvacbase.dbx"	"aecbpipebase.dbx"
		"aecbplumbingbase.dbx"	"aecbtools.dbx"		"aeccivilbase.dbx"
		"aeccmoduleloader.dbx"	"aeccore.crx"		"aeccvbase.dbx"
		"aecloader.arx"		"aecmodeler.dbx"	"aecprojectbase.dbx"
		"aecschedule.dbx"	"aecsolidmodeler.dbx"	"attedit.arx"
		"units.crx"		"vl.arx"		"vl.crx"
	       )
  (command "_.arx" "Load" file)
)

 

Example HERE.

 

 

Message 7 of 9

rdurland
Explorer
Explorer

Thank you @ronjonp , that ended up being the list I needed!

 

I took the liberty of narrowing it down, and the file I needed was apparently "acapp.arx".

 

Thank you both for all your help, @ronjonp and @Sea-Haven .

0 Likes
Message 8 of 9

ronjonp
Mentor
Mentor

Glad to help! 🙂

0 Likes
Message 9 of 9

michellem
Advocate
Advocate

Hello rdurland;

 

This is an old post but it is exactly on point with my problem.

 

Could you tell me how you narrowed it down to "acapp.arx"? Is there any better way other than trial and error?

 

Sincerely;

Michelle

 

0 Likes