The DataCAD Developer Network (DDN) is an online resource for information and support for DCAL® (DataCAD Applications Language) developers as well as anyone interested in creating fonts, toolbars, hatch patterns, or linetypes for use in DataCAD.
#82025 by dhs
Sun Feb 26, 2023 3:06 am
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.
#82026 by dhs
Sun Feb 26, 2023 6:31 am
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);
#82032 by John Daglish
Mon Feb 27, 2023 1:56 pm
"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
#82033 by dhs
Mon Feb 27, 2023 2:25 pm
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.
#82034 by Roger D
Mon Feb 27, 2023 2:38 pm
there is a gridlock macro that will change all grid settings for the on layers to the setting of the active layer.

Who is online

Users browsing this forum: No registered users and 15 guests

About DataCAD Forum

The DataCAD Forum is a FREE online community we provide to enhance your experience with DataCAD.

We hope you'll visit often to get answers, share ideas, and interact with other DataCAD users around the world.

DataCAD

Software for Architects Since 1984