/*! \page pag_Perm-CAD-Objects Perm-CAD-Objects
<pre>
../../doc/gcad_doxygen/Perm-CAD-Objects.dox


\ref Create_CAD-Objects
\ref Display_CAD-Objects
\ref Delete_CAD-Objects
\ref Modify_CAD-Objects




Find_CAD-Objects: see \ref ResolveObjects







</pre>
________________________________________________________________________________
\section Create_CAD-Objects
\code

Permanent CadObjects -
- can have a source-record (ascii-text)
- have a Database-record (index = dbi)
- can have a DisplayList-record (index = dli)

See also Dynamic-DB-Objects


  -----------------------------------------------------------
  // create permanent object from sourceObj (ascii-text):
  // add a single codeline in memory, process code.
  // Creates a source-record, a Database-record and a DisplayList-record
  ED_srcLn_add ("L1=P(0 0 0) P100 0 0)", 0);



  -----------------------------------------------------------
  // create permanent objects from sourceObj (ascii-text):
  // add source-records into a buffer,
  //   add buffer to model and process new codes.
  // Creates source-records, Database-records and DisplayList-records

  // clear global buffer UTF_FilBuf1
  UTF_clear1 ();

  // Init objNrs
  AP_obj_2_txt (NULL, 0L, NULL, 0L);

  // add 2objcts to UTF_FilBuf1
  // using buffer mem_cbuf1 (../xa/xa_mem.h)
  sprintf(mem_cbuf1,"P1=0 0 0");
  UTF_add1_line (mem_cbuf1);
  sprintf(mem_cbuf1,"P2=100 200 0");
  UTF_add1_line (mem_cbuf1);

  // output UTF_FilBuf1 -> CAD
  UTF_insert1 (-1L);

  // update display (work new created objects)
  APED_update__ (-1L);

  // update browser-window (display newly created objects)
  Brw_Mdl_upd ();



  -----------------------------------------------------------
  // create permanent objects from binary objects (complexObj):

  Point     p2={1.0, 1.0, 0.0};
  ObjGX     o1;

  // clear UTF_FilBuf1
  UTF_clear1 ();

  // Init objNrs
  AP_obj_2_txt (NULL, 0L, NULL, 0L);

  // create a complexObj
  OGX_SET_OBJ (&o1, Typ_PT, Typ_PT, 1, &p2);

  // create sourceObj from complexObj in mem_cbuf1; add to UTF_FilBuf1
  // ind -1: get next free ..
  i1 = AP_obj_2_txt (mem_cbuf1, mem_cbuf1_SIZ, &o1, -1L);
    printf(" %d |%s|\n",i1,mem_cbuf1);

  // add objNam  to last sourceObj in UTF_FilBuf1
  UTF_add1_last_add (" #Mittelpkt oben");
    UTF_dump1__ ();   // dump UTF_FilBuf1

  // add a commentline to UTF_FilBuf1
  sprintf(mem_cbuf1,"# this is a test ..");
  UTF_add1_line (mem_cbuf1);

  // output UTF_FilBuf1 -> CAD
  UTF_insert1 (-1L);

  // update display (work new created objects)
  APED_update__ (-1L);


  -----------------------------------------------------------
// create source-record:
  UTF_add_line (src);     // add code to model
  UTF_del_line  (lNr);    // delete line in model


// create Database-record:    (see DB())
  DB_store_obj  ..


// create DisplayList-record:
  DL_StoreObj (typ, dbi, att); // create/update DispList-record
  // for modification call DL_SetInd (dli) before DL_StoreObj
  // see also DL_SetObj


// process code
  WC_Work__ (lNr, src);




  -----------------------------------------------------------
  AP_stru_2_txt       // create sourceObj from complexObj
  UTF_add1_last_add   // add name to last obj in UTF_FilBuf1
  UTO_sav_ost         // create DB-object & save it in Model.








\endcode
________________________________________________________________________________
\section Display_CAD-Objects
\code

Visible CAD-Objects have a DB-record and a DL-record;
- DB-record (the geometry)
- DL-record (the attributes; type, dbi, color, linetype, visible ..)

Dump the DL (DisplList) with Alt+Shift+d     (DL_DumpObjTab())


DB_Store..    create DB-record

GR_Cre..      create dynamic-DB-obj, DL-record and display obj

GR_Disp_..    create DL-record, display obj. Do not create DB-record.

GR_Draw..     display obj. Do not create DB-record, DL-record.


---------------------------------------------------------------

  dbi = -1L;  // create dynamic-obj
  dbi = 123;  // store as "L123"
  // store & get dbi
  dbi = DB_StoreLine (dbi, &ln1);


  // create new DispList-record; returns its index.
  dbi = -1L;  // obj does not have DB-record
  dli = DL_StoreObj (Typ_LN, dbi, 0); 


  // display
  GR_DrawLine (&dli, iAtt, &ln1);

  // display obj
  GR_Draw_obj (&dli, typ, *obj, att, mode);


  // get DispList-Index of last created obj
  dli = GL_GetActInd ();


  ..


  // delete single object
  GL_Del0 (dli);

  // or delete this dl-record and all following records ..
  GL_Delete (dli);




---------------------------------------------------------------
Example create :
  // display obj with DL-record, no DB-record
  #include  "../gr/ut_UI.h"            // SYM..
  Point   p1={10,0,0};
  long  dli;
  GR_Disp_pt (&pt1, SYM_STAR_S, 2);           // creates temp.obj
  DL_Redraw ();                               // update display
  ..
  dli = GL_GetActInd ();                // get DispList-Index of last created obj
  GL_Delete (dli);                      // delete obj and all following


---------------------------------------------------------------
  // modify (do not create new DL-Record with DL_StoreObj)
  DL_SetInd (dli);






\endcode
________________________________________________________________________________
\section Delete_CAD-Objects
\code



  // UNDO for single lines of code
  // add sourceObj's of sourcelines 4 and 8 to do/undo-list
  UNDO_grp_add (4L, 0);
  UNDO_grp_add (8L, 1);



  // UNDO for a block of code
  UNDO_app__ (0);            // init undo (get act.lNr)

  AP_obj_2_txt ..
  UTF_add1_line ..
  UTF_insert1 ..             // add code to mainBuffer

  UNDO_app__ (1);            // create undo-record; activate undo-button



  // delete the active undo-grp & update display
  UNDO_grp_del ();


  // see also Del_tab__  


  // alle temporaer geloeschten Zeilen entfernen (und Undo-Liste entleeren)
  // (temporaer geloeschten Zeilen beginnen mit "_")
  AP_APT_clean ();


  // Das gesamte Textfile loeschen (Funktion File/New)
  UI_menCB (NULL, "new");


\endcode
________________________________________________________________________________
\section Modify_CAD-Objects
\code


  lNr = 8L;
  strcpy(cbuf1,"P1=P(710 350 150)");
  // deactivate line, insert modified line, report change -> UNDO.
  irc = APED_src_chg (lNr, cbuf1); 

  // update DB & display
  APED_update__ (lNr);


  // see also UTF_chg_line   // modify line in memory


\endcode
____________________________________________________________________________
*/
