Author Topic: How to avoid using POINTVAL in macros (and how to find point order of entities)  (Read 387 times)


  • Hero Member
  • *****
  • Posts: 2815
Was just writing a macro and ran into a snag where I was using >UsePresetPoints and getting some real weird results. Took lots of analytical code to figure out that the 'entity' statement that preceded the >UsePresetPoints was putting all the points of the entity in the point buffer. Those along with the points I added to the buffer (>PresetPoints) were all being used by the >UsePresetPoints, thus the strange results.

Of course, my first reaction was this is a bug but then I realized, no, this is a lemon-into-lemonade opportunity. Below is a macro that not only demonstrates the 'entity' statement/>UsePresetPoints (aka, no-need-for-pointval) combo but can also be used to find the point order of entities (and we can abandon the dangerous idea of changing the 'type' in the 'GETATTR/PUTATTR' combo ...oops, maybe I should have kept that to myself...).

The macro uses preset point mode and starts it if you don't already have it on, and turns it off at the end. If it is already on then it stays on at the end and you can see that the points in the buffer can remain there for use after the macro ends.

If you find this macro useful you can remove all the messages and other code that is there for demo purposes.

Code: [Select]
'How to find the Point Order of Dimensions.d3m
'Lar, 23nov17...
'check status of Preset Point Mode, for later...
if sys(1116)=0 then   'if preset point mode is on then turn it off...
end if

message "Draw a dimension..."


>PresetPointMode   'turn on...

entity sys(9)   'get the last entity (the dimension above), this also puts its points in the buffer...

'draw a line through the points of the dim, using the already points in the buffer (and without using pointval code)...

'return preset point mode to original status...

''''sys(1)=0    'the points are still in the point buffer. this code would clear them...

message "Investigate the line to see the point order of dimensions. If Preset Point Mode was originally on (and you did not use the code to clear them) then invoke the Curve command to get a curve through the points of the new line (see macro). Goodbye..."


« Last Edit: November 23, 2017, 02:11:04 PM by Lar »