Author Topic: OpenDCL tips ..  (Read 7176 times)

0 Members and 1 Guest are viewing this topic.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
OpenDCL tips ..
« on: June 05, 2007, 01:39:47 AM »

Regarding ODCL_Project-Load

Generally a project will be loaded and shown in a manner similar to :
Code: [Select]
    ;; Ensure the Project ODC file is loaded.

    (OR (ODCL_PROJECT_LOAD "CTA17-BREAKS.odc") (EXIT))
    ;;
    ;; Show the modal dialog ..
   
    (ODCL_FORM_SHOW CTA17-BREAKS_F)
    ;; The Event handlers manage the form here.


However, when developing a routine/application invariably we are making changes to the ODC file as well as to the Lisp code.

For the changes to the ODC file to be re-loaded   in the current session the reload flag option must be used.

So the Project_Load call can be changed by adding a T to the parameters , eg ;
(OR (ODCL_PROJECT_LOAD "MySuperDuperDialog.odc" T) (EXIT))

Just be sure to remember to remove the reload flag before the dialog is released for general use ... otherwise the dialog code will be reloaded from disk at each invocation.


Personally I do something like this ;
    ;; (ODCL_PROJECT_LOAD "CTA17-BREAKS.odc" T)
    (OR (ODCL_PROJECT_LOAD "CTA17-BREAKS.odc") (EXIT))

... and reload the dialog from the IDE by highlighting the code in brackets and picking the 'Load Selection' button on the IDE menu.


Long story short ... If you are wondering why recent dialog changes are not displaying, check that the reload parameter is being used in the Project_Load call.
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: OpenDCL tips ..
« Reply #1 on: June 05, 2007, 02:47:31 AM »
If you're looking at making captures from AutoCAD to use a s piccys from OpenDCL have a look at the PublishToWeb JPG.pc3 plotter with a Paper size set to the size of the piccy you want.

Then use a scaled rectangle on a non-plot layer to encompass your capture.

A couple of piccys ..
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: OpenDCL tips ..
« Reply #2 on: June 06, 2007, 12:01:16 AM »
From DanielM,

Re the Grid Control.

The row list is Zero based, so effectively the following ensures the display of the last
line ;

  (ODCL_GRID_SELCURROW
    DwgProp_FormDwp_GridProp
    (- (ODCL_GRID_GETROWCOUNT DwgProp_FormDwp_GridProp) 1)
  )
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

LE

  • Guest
Re: OpenDCL tips ..
« Reply #3 on: June 07, 2007, 12:05:27 AM »
I am trying to update some of my routines that use ODCL (That I will be uploaded here when they became available) and downloaded the binaries.

But noticed that if I load the ARX I do not get anymore the function: Odcl_Control_SetToolTipText - it must be renamed?... and if is there a document with those renamed functions, some where?.... Thanks!

Quote
   (Odcl_Control_SetToolTipMainText
    (vl-doc-ref 'drawiz_dwizForm_PictureBox1)
    (if   dh_eng_language
      "Force controlled objects to Color. \r\nfor color change click the color box..."
      "Forzar los objetos controlados a Color. \r\nseleccione en el cuadro de color para cambiarlo..."
      ))
;;;;;;;;;  (Odcl_Control_SetToolTipText
;;;;;;;;;    (vl-doc-ref 'drawiz_dwizForm_PictureBox1) "Color"
;;;;;;;;;;;;    (if   dh_eng_language
;;;;;;;;;;;;      "Force Options"
;;;;;;;;;;;;      "Forzar Opciones")
;;;;;;;;;    )

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: OpenDCL tips ..
« Reply #4 on: June 07, 2007, 01:56:50 AM »
Luis,
Try ToolTipMainText

« Last Edit: June 07, 2007, 01:59:48 AM by Kerry Brown »
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: OpenDCL tips ..
« Reply #5 on: June 08, 2007, 10:22:43 PM »
Was that what you wanted ?
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

LE

  • Guest
Re: OpenDCL tips ..
« Reply #6 on: June 08, 2007, 10:25:16 PM »
Was that what you wanted ?


Hi Kerry;

Yes, and I think Odcl_Control_SetToolTipText still must be there, for some reason when I downloaded the binaries (ZIP) I do not get all the features in the intelligent help, as it was in ObjectDCL.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: OpenDCL tips ..
« Reply #7 on: June 08, 2007, 10:33:40 PM »
You may need the full .MSI install to get the .MTH definition files used in the Browser. They are different to the old original files.
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: OpenDCL tips ..
« Reply #8 on: June 08, 2007, 10:42:05 PM »
... and the Odcl_Control_SetToolTipText is not available in Beta 15 .
Odcl_Control_SetToolTipMainText is.
This is an extract from Atoms ;

kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

LE

  • Guest
Re: OpenDCL tips ..
« Reply #9 on: June 08, 2007, 10:59:23 PM »
OK

I was able to fix my old odcl code.


Thanks
« Last Edit: June 09, 2007, 11:43:22 AM by LE »

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: OpenDCL tips ..
« Reply #10 on: June 08, 2007, 11:27:59 PM »
Efforts have been made to read the old ODC files as well as the one generated from the new IDE.
To make the most of the new editor users SHOULD install the full package, not dump the binaries into an old folder with legacy support and example files.
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: OpenDCL tips ..
« Reply #11 on: June 11, 2007, 11:59:46 PM »
If you do an amount of property switching for visibility, enabled, color etc
think about doing the process in a foreach block ..
note necessarily faster, but sure is easier on the eyes ..


;;;------------------------------------------------------------
(DEFUN _HighlightControl (Control)
    (FOREACH item (LIST CTA17-GridBalloons_F_Single12
                        CTA17-GridBalloons_F_Crossover
                        CTA17-GridBalloons_F_FullGrid
                  )
        (ODCL_CONTROL_SETBACKCOLOR item -16)
    )
    (ODCL_CONTROL_SETBACKCOLOR Control -14)
)
;;;------------------------------------------------------------
;;;------------------------------------------------------------
(DEFUN _SetoutTablesOn ()
    (FOREACH control (LIST
                         CTA17-GridBalloons_F_X-Label
                         CTA17-GridBalloons_F_X-Grid
                         CTA17-GridBalloons_F_Addx
                         CTA17-GridBalloons_F_ClearX
                         ;;
                         CTA17-GridBalloons_F_Y-Label
                         CTA17-GridBalloons_F_Y-Grid
                         CTA17-GridBalloons_F_AddY
                         CTA17-GridBalloons_F_ClearY
                         ;;
                         CTA17-GridBalloons_F_AddDimensions
                         CTA17-GridBalloons_F_DimensionCombo
                         CTA17-GridBalloons_F_DimensionFrame
                         ;;
                         CTA17-GridBalloons_F_ReadDataFile
                         CTA17-GridBalloons_F_SaveDataFile
                        )
        (ODCL_CONTROL_SETVISIBLE control T)
    )
    ;;
    (Odcl_Control_SetCaption CTA17-GridBalloons_F_X-Label "X ... Setout")
    (Odcl_Control_SetCaption CTA17-GridBalloons_F_Y-Label "Y ... Setout")
    ;;

)
;;;------------------------------------------------------------
(DEFUN _SetoutX-TablesOff ()
    (FOREACH control (LIST
                         CTA17-GridBalloons_F_X-Label
                         CTA17-GridBalloons_F_X-Grid
                         CTA17-GridBalloons_F_AddX
                         CTA17-GridBalloons_F_ClearX
                         CTA17-GridBalloons_F_ReadDataFile
                         CTA17-GridBalloons_F_SaveDataFile
                        )
        (ODCL_CONTROL_SETVISIBLE control nil)
    )
)
;;;------------------------------------------------------------

;; and the calling code looks something like this ..


;;;------------------------------------------------------------
(DEFUN c:CTA17-GridBalloons_F_Crossover_OnClicked (/)
    (_HighlightControl CTA17-GridBalloons_F_Crossover)
    (_SetoutX-TablesOff)
    (_SetoutY-TablesOff)
    (_Setout-DimsOff)
    (ODCL_FORM_RESIZE CTA17-GridBalloons_F 295 335)
    (SETQ gvar:BalloonStyle 2)
)

;;;------------------------------------------------------------

kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: OpenDCL tips ..
« Reply #12 on: June 12, 2007, 07:40:37 PM »
For anyone who is using the GridControl and wants to save the data.

This code reads the data from 2 columns in each of 2 GridControls ...


;;;------------------------------------------------------------
    (DEFUN _extractGridData ()
        (SETQ
        ;;.............. removed for clarity             
        )
        (SETQ RowCount (ODCL_GRID_GETROWCOUNT CTA17-GridBalloons_F_X-Grid)
              RowIndex    0
              g:dataListX   '()
        )
        (WHILE (< RowIndex RowCount)
            (SETQ g:dataListX
                     (CONS (CONS (ODCL_GRID_GETITEMTEXT CTA17-GridBalloons_F_X-Grid RowIndex 1)
                                 (ODCL_GRID_GETITEMTEXT CTA17-GridBalloons_F_X-Grid RowIndex 2)
                           )
                           g:dataListX
                     )
            )
            (SETQ RowIndex (1+ RowIndex))
        )
        (setq g:dataListX (reverse g:dataListX))
        ;;--
        (SETQ RowCount (ODCL_GRID_GETROWCOUNT CTA17-GridBalloons_F_Y-Grid)
              RowIndex    0
              g:dataListY   '()
        )
        (WHILE (< RowIndex RowCount)
            (SETQ g:dataListY
                     (CONS (CONS (ODCL_GRID_GETITEMTEXT CTA17-GridBalloons_F_Y-Grid RowIndex 1)
                                 (ODCL_GRID_GETITEMTEXT CTA17-GridBalloons_F_Y-Grid RowIndex 2)
                           )
                           g:dataListY
                     )
            )
            (SETQ RowIndex (1+ RowIndex))
        )
        (setq g:dataListY (reverse g:dataListY))       
    )
;;;------------------------------------------------------------


... and then writes it to disk using (ODCL_WRITEBIN <fnHandle> <data>) in the
c:CTA17-GridBalloons_F_SaveDataFile_OnClicked function.

Note that this uses the version of ODCL_WRITEBIN updated and posted here by dan yesterday ( should be included in Build Beta17 )


(DEFUN c:CTA17-GridBalloons_F_SaveDataFile_OnClicked (/ documentpath data fnHandle)
    (_extractGridData)
    (SETQ documentpath (GETFILED "Source File" (GETVAR "dwgprefix") "data" 1)
          data         (LIST g:dataListX g:dataListY)
          fnHandle     (ODCL_OPENBIN documentpath "w")
    )
    (ODCL_WRITEBIN fnHandle data)
    (ODCL_CLOSEBIN fnHandle)
)


 ... and this is the data.
Quote
((("1" . "2000")
  ("2" . "3000")
  ("3" . "2000")
  ("3a" . "1000")
  ("3b" . "1200")
  ("4" . "1500")
  ("5" . "2500")
  ("6" . "2800")
  ("7" . "2000")
 )
 (("A" . "3000")
  ("B" . "3000")
  ("C" . "3000")
  ("D" . "3000")
  ("E" . "3000")
  ("F" . "3000")
 )
)

... and the obligatory piccy ..
« Last Edit: June 12, 2007, 07:46:41 PM by Kerry Brown »
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.