Access custom properties in Fields
If I want to use Custom Properties of a mechanical part in the drawings sheets.
https://help.bricsys.com/document/_guides--MCAD_assembly_design--GD_custompropertiesofmechanicalcomponents/V22/EN_US?id=165079164093
I can access them as Fields if the custom properties are put into the File -> Drawing Properties

If I add them as Custom Properties I cannot find them in the Fields.

Also tried looking into Lisp to access the Custom Properties but no such luck in the documentation.
They are easier to input as Custom Properties as they are avaliable without having to open a new window.
https://help.bricsys.com/document/_guides--MCAD_assembly_design--GD_custompropertiesofmechanicalcomponents/V22/EN_US?id=165079164093
I can access them as Fields if the custom properties are put into the File -> Drawing Properties

If I add them as Custom Properties I cannot find them in the Fields.

Also tried looking into Lisp to access the Custom Properties but no such luck in the documentation.
They are easier to input as Custom Properties as they are avaliable without having to open a new window.
0
Comments
-
Do you need a lisp to access the custom properties of the drawing (DWGPROPS) or something else?
If its for DWGPROPS, there’s a few around, I probably have one.
BTY, the DWGPROPS in your picture doesn’t have values. I don’t know if that’s an issue. I’m not familiar with that mech dialog though so I’m probably should be ignored : )
0 -
As stated not problem accessing the properties in DWGPROPS, what I want is to access the custom properties from a field in the second image, they are empty but that does not change the problem.0
-
@Linnemann
You will find them under "document" instead. (perhaps few years have passed and it's an old forum but it's good to keep the discussion going to help today's users)0 -
Hello all
I found a workaround to this problem that Bricsys have been unwilling (not prioritised) to add for a few years now (Multiple SR).
Its more of a stupid hack.
Via LISP I override the save function to add custom properties to the DWGPROPS of the drawing.
I can then use those in the Fields and the TitleBlock. The code is by no means done, its a proof of concept.
;; Source:
;; https://forums.augi.com/showthread.php?93534-Run-lisp-when-closing-drawing/page2
(vl-load-com) (princ " Loaded onSave.\n") ;(setq MATE "TEST") (defun loadTheSaveReactor ()
(vl-load-com)
(vl-load-reactors)
(if FileOnSave (vlr-remove FileOnSave))
(setq FileOnSave
(vlr-command-reactor nil '((:vlr-commandwillStart . AtSaveCommand)))
)
)
(loadTheSaveReactor) (defun AtSaveCommand (calling-reactor b)
(if
(wcmatch (car b) "SAVE")
(progn
(setq doc (vla-get-ActiveDocument (vlax-get-acad-object)))
; (vla-SendCommand doc (c:MyLisp))
(vla-SendCommand doc (strcat "MyLisp "))
)
)
) (defun getCustomDwgProp (key / app doc dwgprops try val)
(vl-load-com)
(setq App (vlax-Get-Acad-Object)
Doc (vla-Get-ActiveDocument App)
DwgProps (vla-Get-SummaryInfo Doc)
)
(cond
((vl-catch-all-error-p
(setq try (vl-catch-all-apply
'vla-GetCustomByKey
(list DwgProps key 'val)
)
)
)
(setq val nil)
)
)
val
) (defun SetCustomDwgProp (key value / App Doc DwgProps)
(vl-load-com)
(setq App (vlax-Get-Acad-Object)
Doc (vla-Get-ActiveDocument App)
DwgProps (vla-Get-SummaryInfo Doc)
)
(if (getCustomDwgProp key)
(vla-SetCustomByKey DwgProps key value)
(vla-AddCustomInfo DwgProps key value)
)
) (defun c:MyLisp ( / x y)
;(princ "Print to make sure we got to here.\n")
(setq x (type (BmLispGet "Components"))) (if (eq 'sym x)
(progn
(princ "Is not a Component, please convert to Mechanical component.\n")
)
(progn
(setq y (BmLispGet "Description" (car (BmLispGet "Components"))))
(if (= y "")
(setq y "----")
) (if (BmLispGet "HasMaterial" (car (BmLispGet "Components"))) (progn (SetCustomDwgProp "Material" (BmLispGet "Material" (car (BmLispGet "Components")))) (SetCustomDwgProp "Description" y) (command "_REGEN") ) (progn (princ "Has No Material") ) ) ) )
(princ)
)You need to autoload this in "on_doc_load.lsp" in the support folder.
0