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.
#71354 by dhs
Thu Apr 27, 2017 10:42 pm
Hi,

I am currently using getmode to allow the user to select one or more entities, and my macro simply keeps the returned mode_type variable in memory for subsequent use (it is not used immediately after the getmode call, but may subsequently be used more than once before the user exists the macro).

But I have found an issue in that the mode variable returned by getmode appears to be related to the viewing projection in some way.
i.e. a mode that has been selected in plan view only seems to be valid in plan view. If I change to an elevation view then mode does not return any entities. If I change back to plan view then mode will once again return the expected entities.
Note that I am doing this in DataCAD 11, but I assume the same would apply to later versions?

In the context of my macro I want the selected entities to be valid in any viewing projection, so my question is:

Can anybody suggest a better way of storing the selection?

I have thought of the following possibilities:

1. Use a selection set. This is my preferred option at this stage. I could step through the 8 available sets and use ssLength to find one that is not in use (to ensure I didn't clobber a set that was being used for something else). But my question is: How many users are likely to already be using all 8 sets? Is this likely to be an issue?

2. Write an attribute to the selected entites and then use Mode_Atr to retrieve them. I assume that a mode_atr would not have the same view relationship, so I think this could work quite well. But am not sure of the wisdom of adding a temporary attribute to entities that the macro otherwise has no business in updating. Am I being a bit too cautious about this ?

3. Keep the individual entity addresses in memory. This could work, but is my least preferred option. I would store them in an array, but I would need to set a size for the array (so if the user selected more than that number of entities I would not be able to store them all).

4. Write the entity addresses to a file. I think this would be a viable options, but can I do this with Datacads file i/o routines??? The sample WRITE macro's WRITELIB.INC file declares f_wraddr as an external function, but I cannot see this documented anywhere in the DCAL manual (nor in the dcalnew.doc included with DataCAD 11).

5. Write the entity details to file. In this instance I do not need to modify the entity so don't really need to know its address. e.g. for a polygon I just need plyNpnt and plyPnt.


As stated, a selection set is my preferred option, but this is subject to ascertaining that very few users are likely to be already using all 8 sets. So I would be interested in anybody on this forum has an opinion on that?

Is there an obvious option that I have missed ?

Thanks,
David H.
#71356 by joshhuggins
Thu Apr 27, 2017 11:12 pm
dhs wrote:But my question is: How many users are likely to already be using all 8 sets?
FWIW, I haven't touched Selection Sets since Mask and the expanded clipboards were added.
#71360 by David A. Giesselman
Fri Apr 28, 2017 10:18 am
David,

Just use a Selection Set that is not available to users. I would suggest 11 as it is rarely used internally to DataCAD.

Dave
#71421 by dhs
Wed May 03, 2017 7:06 pm
ok,
so we shouldn't use Sel Set 11 when the user has control (due to the possibility of them pressing Ctrl/C).
I have a situation where I may use Sel Set 11, but it is not suitable as a solution where user input is involved. My gut feel is that most users will not use all of the availableSelection Sets (thanks Josh for your input also), so I am going to use one of the first 8 sets (but give the user control over which one so that they are aware of what it is doing and can exit the macro if they don't like it!)
thanks,
David H.

Who is online

Users browsing this forum: No registered users and 10 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