OpenDCL Forums

OpenDCL => Runtime/AutoLISP => Topic started by: velasquez on December 08, 2008, 04:27:07 AM

Title: Beta 4 - dcl_Form_GetControls and dcl_Project_GetForms
Post by: velasquez on December 08, 2008, 04:27:07 AM
(dcl_Form_GetControls HTML_Dcl1) 
Return (<Entity name: 127b1ca0> <Entity name: 127b1f40> <Entity name: 127b1c30> <Entity name: 127b1ed0> <Entity name: 127b1e60> <Entity name: 165b7f0> <Entity name: 122769f0> <Entity name: 1282a060> <Entity name: 1282a0d0> <Entity name: 1282a140> <Entity name: 1282a1b0> <Entity name: 1282a220> <Entity name: 1282a290> <Entity name: 1282a300> <Entity name: 1282a370> <Entity name: 1282a3e0> <Entity name: 1282a450> <Entity name: 1282a4c0> <Entity name: 1282a530>) 
 
(DCL_PROJECT_GETFORMS " HTML ") 
Return (<Entity name: 12800428>) 
 
It is not possible to treat this list with -> (entget ename [applist]) 
That is a BUG? 
Title: Re: Beta 4 - dcl_Form_GetControls and dcl_Project_GetForms
Post by: owenwengerd on December 08, 2008, 05:44:08 AM
That is not a bug. Forms and controls are not AutoCAD entities, despite their representation in AutoLISP as entity names.
Title: Re: Beta 4 - dcl_Form_GetControls and dcl_Project_GetForms
Post by: velasquez on December 08, 2008, 07:17:05 AM
Ok Owen, 
How to work with this list? 
Should not she show the names of Forms and of the controls?
Title: Re: Beta 4 - dcl_Form_GetControls and dcl_Project_GetForms
Post by: BazzaCAD on December 08, 2008, 08:09:32 AM
Here's an example written by Owen, that shows how to read all the controls on a form, change their properties & write them back to a new ODCL file.



(DEFUN SetOdclFontSizeUnscaled (odclfile password newodclpath / project props fontsize)
  (SETQ project (DCL_PROJECT_LOAD odclfile))
  (IF (NOT project) (EXIT))
  (FOREACH form (DCL_PROJECT_GETFORMS project)
    (FOREACH control (DCL_FORM_GETCONTROLS form)
      (PROGN (SETQ props (dcl_control_getproperties control))
        (IF (MEMBER "FontSize" props)
          (PROGN
            (SETQ fontsize (DCL_CONTROL_GETPROPERTY control "FontSize"))
              (IF (> fontsize 0)
                (DCL_CONTROL_SETPROPERTY control "FontSize" (- 0 fontsize))
              )
            )
          )
        )
      )
    )
    (DCL_PROJECT_SAVEAS project newodclpath password)
)

(SetOdclFontSizeUnscaled "project1.odcl" nil "C:/temp/project2.odcl")
Title: Re: Beta 4 - dcl_Form_GetControls and dcl_Project_GetForms
Post by: velasquez on December 08, 2008, 12:47:49 PM
The function dcl_control_getproperties doesn't exist in BETA-4. 
Was the name of the function modified?
Title: Re: Beta 4 - dcl_Form_GetControls and dcl_Project_GetForms
Post by: BazzaCAD on December 08, 2008, 01:40:21 PM
Hmmm that's strange, it's in the help file, but it's not in the ARX.
I'm sure it's a mistake. What say Owen. :)
Title: Re: Beta 4 - dcl_Form_GetControls and dcl_Project_GetForms
Post by: owenwengerd on December 08, 2008, 02:25:10 PM
Oops. I've put it back for Beta 5.