Page 1 of 1

Setting orthmode numdivs (D4D)

PostPosted: Sun Feb 26, 2023 3:06 am
by dhs
I am trying to set the number of orthmode divisions, but it is not working...

The variable I am setting is PGsavevar^.numdivs, and the value there is being set correctly (have examined in debugger), but it is not impacting the orthmode setting at all.

Below is the relevant bit of my code:
Code: Select all          l^.svOrthMode := PGsavevar^.orthmode;
          l^.svNumDivs := PGsavevar^.numdivs;
          PGsavevar^.orthmode := true;          // try to force them to select a point at
          PGsavevar^.numdivs := 2;              // the same Y value as prev point
          rubln^ := true;
          wrtmsg ('Select point to indicate X value of 2nd baseline point');
          getpointp(vmode_orth, false, l^.getp, retval);


Does anybody know if PGsavevar^.numdivs is the correct variable to be setting? ... or any other suggestions as to why my logic is not working?

Note: If I set snap angle divisions to 2 in the grid settings in DataCAD before invoking the macro then it performs as expected.

Many Thanks,
David H.

Re: Setting orthmode numdivs (D4D)

PostPosted: Sun Feb 26, 2023 6:31 am
by dhs
ok, finally worked this out for myself ....

The setting I was looking for was in the layer record. (not certain if there may be a setting somewhere that determines if grid settings are by layer ??? - if there is that may still catch me out)

The logic I am using now is shown below and is giving the desired result:
Code: Select all          lyr_get (getlyrcurr, l^.svrlyr);     // get current lyr record
          l^.svOrthMode := PGsavevar^.orthmode;
          l^.svNumDivs := l^.svrlyr.numdivs;   // save numdivs from lyr record
          l^.svGridAng := l^.svrlyr.gridang;   // save grid angle from lyr record
          PGsavevar^.orthmode := true;
          l^.svrlyr.numdivs := 2;   // set numdivs and gridang in local variable
          l^.svrlyr.gridang := 0;   // so that ortho mode gives horizontal angles
          lyr_put (l^.svrlyr);    // put local variable back to actual layer record
          rubln^ := true;
          wrtmsg ('Select point to indicate X value of 2nd baseline point');
          getpointp(vmode_orth, false, l^.getp, retval);

Re: Setting orthmode numdivs (D4D)

PostPosted: Mon Feb 27, 2023 1:56 pm
by John Daglish
"Each layer has several independent settings that you can customize. These include grid size, grid angle, whether the snap grid is toggled on or off, whether ortho (plan) mode is toggled on or off, and layer color. See “Setting Up Your Drawing Grids” earlier in this chapter for more information on grid settings." p179 Datacad 21 manual

Regards

John Daglish

Re: Setting orthmode numdivs (D4D)

PostPosted: Mon Feb 27, 2023 2:25 pm
by dhs
Thanks John,

From what I read in the manual, it seems the grid settings are always per layer.
I thought I may have had some recollection of an option to choose an 'overall' setting (not per layer) for grids, but I cannot find anything about that in the manual so assume that the logic I have now should hopefully be adequate.

Not certain what the numdivs value in PGsavevar is ... it may be intended to be a readonly value for quick access to the current layer setting (when debugging I did notice that it had the current layer value before I changed it, but changing it did not have any impact on the actual setting for the current layer).

Regards,
David H.

Re: Setting orthmode numdivs (D4D)

PostPosted: Mon Feb 27, 2023 2:38 pm
by Roger D
there is a gridlock macro that will change all grid settings for the on layers to the setting of the active layer.