;;;----------------------------------------------------------------------------;;;
;;; ;;;
;;; LSP file with DCL in normal form (master LSP = source for DCL) ;;;
;;; ;;;
;;;----------------------------------------------------------------------------;;;
;;; Example written by Marko Ribar, d.i.a. (architect) : 22.02.2022. ;;;
;;;----------------------------------------------------------------------------;;;
;| DCL file
MyPropsTest :dialog {key="set-title"; width=93.3; height=21.875;
:text {label="Thanks Michael Puckett!! @ www.theswamp.org";}
:column {children_fixed_height=true; children_fixed_width=true;
:list_box {label="List of properties to modify"; key="PropsListbox"; height=14.5; width=92; tabs=40;}
:text {key="TextLabel"; width=90;}
:edit_box {key="PropsEditbox"; edit_width=90;}
}
:row {children_fixed_height=true; children_fixed_width=true;
:spacer {}
:button {label="Pick point"; key="PickPt";}
:button {label="Pick from list"; key="PickList";}
:button {label="Apply"; key="accept"; allow_accept=true;} // is_default=true;
:button {label="Done"; key="cancel"; is_cancel=true;}
:spacer {}
}
}
MyPropsList :dialog {label="Select item from list.";
:list_box {key="PropsListbox2"; height=15; width=40;}
:row {
:spacer {}
:button {label="Cancel"; key="cancel"; is_cancel=true;}
:spacer {}
}
}
|;
;;; DCL specification must be in this form at the top of main LSP file ;;; you should use paragraph comments to exclude it from loading and evaluating with [ ;| and |; ] like here in this example ;;; NOTE : dcl must not have blank lines ;;;
;; String to List - Lee Mac
;; Separates a string using a given delimiter
;; str - [str] String to process
;; del - [str] Delimiter by which to separate the string
;; Returns: [lst] List of strings
(defun LM:str
->lst
( str del
/ len lst pos
) )
)
)
(defun strip_dcl
( lspfile
/ nf sf filename
) )
)
filename
)
) ;;; end (stripsubs)
(defun GetVlaAtoms
nil ; By: Michael Puckett )
)
;-----------------------------------------------------------------------------------------
(defun GetVlaProperties
( atoms
) ; By: Michael Puckett symbolname
"vla-get-*"
;; don't need 'put'
)
)
)
)
)
)
)
;-----------------------------------------------------------------------------------------
(defun GetVlaMethods
( atoms
) ; By: Michael Puckett symbolname
"vla-get-*,vla-put-*"
;; need 'put'
)
)
)
)
)
)
)
;----------------------------------------------------------------------------------------------
(defun ApplyToObject
( / NewValue OldValue Prop
) ( (= (type OldValue
) 'INT
) (setq NewValue
(atoi NewValue
)) ) )
(/= (get_tile "PropsEditbox") "*Error getting value!!") )
"set-title"
(strcat ARCH#LOGO
" : PROPS Get Properties" " : Could not update property \"" Prop
"\"!!") x
"\t"
(strcat ARCH#LOGO
" : PROPS Get Properties" " : Error getting value!!") tmpChk
)
)
)
)
)
)
PropList
)
(strcat ARCH#LOGO
" : PROPS Get Properties" " : Updated property \"" Prop
"\"") )
)
)
(set_tile "set-title" (strcat ARCH#LOGO
" : PROPS Get Properties" " : Not able to edit property.")) )
)
)
;----------------------------------------------------------------------------------------------
(defun ListboxSelection
( / tmpNum Prop
) (= (get_tile "PropsEditbox") "*Error getting value!!") )
)
)
)
)
( t
)
)
)
;----------------------------------------------------------------------------------------------
(defun PickFromList
( dch
/ tmpList tmpValue Prop OldValue
) (if (not (new_dialog "MyPropsList" dch
"" '
(-1 -1))) ;(not (new_dialog "MyPropsList" DiaLoad)) )
( (= (strcase Prop
) "LINETYPE") (setq tmpList LTList
) ) )
)
( (= (strcase Prop
) "TEXTSTYLE") (setq tmpList StyList
) ) )
"PropsListbox2"
"(if (= $reason 1) (progn (setq tmpValue (nth (read (get_tile \"PropsListbox2\")) tmpList)) (done_dialog 1)))")
"cancel"
"(progn (setq tmpValue OldValue) (done_dialog 0))")
tmpValue
)
)
;----------------------------------------------------------------------------------------------
(defun DialogPortion
( dcl TextLabel Point
/ tmpProp
) (setq ARCH#LOGO
" Tim Willey's") )
;(setq DiaLoad (load_dialog "ARCH_GrabProperties.dcl"))
(if (not (new_dialog "MyPropsTest" dch
"" '
(-1 -1))) ;(not (new_dialog "MyPropsTest" DiaLoad)) )
x
"\t"
"*Error getting value!!"
tmpChk
)
)
)
)
)
)
PropList
)
;(set_tile "TextLabel" "")
)
;(set_tile "PropsEditbox" "")
)
(action_tile "PickPt" "(progn (setq tmpProp (get_tile \"TextLabel\")) (done_dialog 3))") (action_tile "PickList" "(set_tile \"PropsEditbox\" (PickFromList dch))") (action_tile "PropsListbox" "(if (= $reason 1) (ListboxSelection))") (PickPoint dcl tmpProp)
)
)
;----------------------------------------------------------------------------------------------
(defun PickPoint
( dcl tmpProp
/ tmpPt
) )
;----------------------------------------------------------------------------------------------
(defun c:PRPS
( / *error* _findfile LM:str
->lst strip_dcl lspfile dcp dcl dch ActDoc LayList StyList LTList DimList Sel tmpObj PropList
ColumnLng Columns Remander ListCnt ColumnCnt DiaFile Opened
DiaLoad GetPointCnt BlkList PageTwo ObjDim ARCH#LOGO )
;| Creates a dialog box with all the properties available per object selected. Ones that can't be
edited are greyed out, but this show you what they are.
With objects that have the property coordiantes, you have to enter them in the way they are shown.
I'm trying to find a better way to do this, but until then. Objects that have points, have a pick button
next to them, but that doesn't work right now, so you have to enter the new point value as a list.
Thanks to Michael Puckett for the codes provided within the routine.
Use at your own risk. Tested one A2k4. Change to suite your needs. I am not to be blamed for anything
that happens to your computer if you use this routine, and neither is anyone else named in this routine.
v1.0 Issued for use. 12/27/05
v2.0 Changed the layout. It no longers writes it own dialog box. It puts all the properties into one
dialog box, and you can edit them form there. Weither you pick it from a list, or pick a point.
I like the other format better, but this is the only way I could get it to work with being able
to pick a point, and work with the length of all the dimension properties. Changed how you call it
just incase people want to see the difference.
12/28/05
|;
(and dch
(< 0 dch
) (unload_dialog dch
)) ; Unloads the DCL file associated with dcl_id (obtained from a previous new_dialog call) from memory. Always return nil (and dcp
(findfile dcp
) (vl-file-delete dcp
)) ;;; COMMENT THIS LINE IF YOU ARE UNABLE TO GET DIALOG BOX INITIALIZING - (load_dialog) FAILURE TO BE ABLE TO START "NOTEPAD++" TO EXAMINE DCL FILE... IN MOST OF SITUATIONS DCL IS GOOD, BUT (load_dialog) FAILS AS ACTUALLY FUNCTION CAN'T FIND FILE PATH AND IS NOT WITH ADEQUATE FILENAME SPECIFICATION, AND PERHAPS YOU SHOULD PUT TMP.DCL FILE NOT IN TMP FOLDER, BUT SUPPORT SPSF OF ACAD/BCAD ;;; )
(defun _findfile
( libraryrootprefix filenamepattern
/ subs processsubfolders folders r
) ;;; (_findfile "F:\\ACAD ADDONS-NEW\\" "profile*.lsp")
)
(defun processsubfolders
( rootfolder
/ subfolders
) (setq subfolders
(subs rootfolder
)) )
)
r
)
(setq folders
(append (list libraryrootprefix
) (processsubfolders libraryrootprefix
))) y
x
)
)
)
)
)
)
)
)
) folders
)
)
(setq lspfile
(_findfile
"C:\\ACAD ADDONS-NEW\\" "PRPS.lsp"))
(stripsubs) ;;; loading subs for striping DCL from this LSP with DCL in normal form (LSP = source file of DCL) ;;;
(setq dcp
(strip_dcl lspfile
))
(if (not GlbVarPropertiesList
) (setq GlbVarPropertiesList
(GetVlaProperties
(GetVlaAtoms
))) )
)
)
)
)
)
)
)
)
)
)
(setq Sel
(entsel "\n* Select object to edit properties [or Nested to selected nested object]: ")) Sel
)
)
)
(DialogPortion dcl nil nil)
)
)
(*error* nil)
)