snap functionality
snap functionality
i'm trying to implement this functionality. before i start i would like to know:
- i can't see this funtionality implemented in odamfcapp although it appears
that have introduced a little interface related with it, so it could mean
that you are planning to introduce it in next releases, am i right?.
- if i'm right, are you going to implement it at application level or at libraries
level as you have made with grip funtionality?.
best regards.
i assume all your team is really busy but i "believe" this is a question that doesn't need a very long or a very difficult answer. i need some orientation in order to plan my approach.
also, if there is a memeber of this forum that could help me, i'd appreciate it very much.
thanks in advance and best regards.
snap points functionality is intended to be handled exactly as grip points. the date for having it implemented for all entities is not determined yet. maybe half an year..
sergey slezkin
i assume that you have looked at examples\grippoints\dbarcgrippoints.cpp, oddbarcgrippointspe::getosnappoints()
this is the way to implement snapping behaviour currently.
vladimir
thanks for your replies.
yes i have seen that function and when i saw it i looked for a similar function correspondent to other kind of entities, i didn't found.
so, could you tell me a brief description of the code that is needed to add in order to complete the implementation of snap functionality?.
i'd like to know whether it's more difficult to me trying to implement the code that is needed in your libraries or write a code that doesn't use the same schema.
for example an alternative approach maybe could be the following:
when in viewer onmousemove funtion, it could be made a selection near "point" and if there are elements in selection set, compare distances between point and snap points of the selected entities and make the mouse move to the nearest of those points.
i guess this approach is too simple but i'd like a lot a comment about my dilemma.
i'd also appreciate help by other users.
thanks in advance.
oddbgrippointspe::getosnappoints just returns the snap points, for the given snap mode. it's the application task to do something with them. we added some trivial snapping implementation to the grippoints sample, but you are on your own in enchancing it further.
that is - it should be distinguished: getosnappoints() implementation, for all the entities, and snapping behaviour in the application, that will use snap points obtained from the entities.
vladimir
hello,
i need some advice about the following question:
in odamfcapp grip (also snap) functionality is restricted to a set of selected entities, i mean user must select entities, at that moment grip points of the selected entities are saved and then used in functions like onmousemove.
but, what if i need to implement snap functionality for all entities present in a drawing?, would it be efficient to save all snap points for all posible snap modes for all entities?, could you tell me which "dwgdirect related" technique/s could i use or something about what is important to be taken in account?.
thanks again.
you may build some kind of spatial index of the entities, and, when user moves the mouse, look in the index for the list of entities being passed over, and ask them for their snap points. building such index may be integrated in the drawing device. of course you may just collect all the snap points in the first regen, but that might slow down initial rendering a bit. (depends on the entities, and their amount)
vladimir
imple point snap
hi , we use the dd viewer functionality in our own application for drawing referenced dwg/dxf files.
on mouse move we want to detect e.g the endpoint of a line inside dwg.
we doesn磘 need is any highlighting or box drawing, we want to get only the coordinates of the nearest point.
i looked in odamfcappl and found
odexeditorobject:

nmouseleftbuttonclick
is there an easier entry point to do the point snap ?
regards,
uwe
hi uwe,
odexeditorobject is only an example of how editing could be implemented, so you are free to use it or not (for simple tasks most part of it might be redundant).
i don't sure i understand what you mean "easier entry point" ?..
quote:
on mouse move we want to detect e.g. the endpoint of a line inside dwg.
odexeditorobject:

nmousemove