M76 Posted May 23, 2019 Share Posted May 23, 2019 Help please! I'm stuck. I'm writing a routine that calls the "Rubber sheet" command in MAP3D numerous times. And it seems that each time "adersheet" is called it creates a new selection set causing the 128 limit to run out quickly. I literally need to call the command 200.000 times. And currently everything breaks after about a hundred. Any ideas how to get around this? Thanks. Quote Link to comment Share on other sites More sharing options...
dlanorh Posted May 23, 2019 Share Posted May 23, 2019 (edited) 6 hours ago, M76 said: Help please! I'm stuck. I'm writing a routine that calls the "Rubber sheet" command in MAP3D numerous times. And it seems that each time "adersheet" is called it creates a new selection set causing the 128 limit to run out quickly. I literally need to call the command 200.000 times. And currently everything breaks after about a hundred. Any ideas how to get around this? Thanks. Every time you create a selection set, process it into a list. Edited May 23, 2019 by dlanorh Quote Link to comment Share on other sites More sharing options...
BIGAL Posted May 24, 2019 Share Posted May 24, 2019 Is not rubbersheeting meant to apply algorithm like Helmert transformation to multiple objects so why would you do it 200,000 times ? The idea behind rubber sheet is to pick OBJECTS and apply to a series of control points. Quote Link to comment Share on other sites More sharing options...
M76 Posted May 24, 2019 Author Share Posted May 24, 2019 13 hours ago, dlanorh said: Every time you create a selection set, process it into a list. I'm not creating a selection set. The rubbersheet command does I merely pass an object reference to it. (setq pont (entlast)) (vl-cmdf "_adersheet" ) (foreach pot nlist (if (< 0.0 (car (nth pot pixel)))(vl-cmdf (nth pot pixel) (nth pot targetpoints)))) (vl-cmdf "" "_a" pont "") When passing "pont" to the command it creates a selection set object, that I cannot reference, therefore I also cannot empty or delete. Quote Link to comment Share on other sites More sharing options...
M76 Posted May 24, 2019 Author Share Posted May 24, 2019 (edited) 3 hours ago, BIGAL said: Is not rubbersheeting meant to apply algorithm like Helmert transformation to multiple objects so why would you do it 200,000 times ? The idea behind rubber sheet is to pick OBJECTS and apply to a series of control points. I'm not using it for the intended purpose. I'm using it to iterate trough a series of control points, to check the deviation between each point and their neighbours. Which means I'm transforming each point one by one. And I'll have roughly 200.000 control points for the project I'm currently working on. Edited May 24, 2019 by M76 Quote Link to comment Share on other sites More sharing options...
BIGAL Posted May 24, 2019 Share Posted May 24, 2019 You should have said that there is deviation lisps out there basically if you have two layers can be done easily. Exist - Design > tolerance identify. Quote Link to comment Share on other sites More sharing options...
M76 Posted May 24, 2019 Author Share Posted May 24, 2019 5 minutes ago, BIGAL said: Exist - Design > tolerance identify. Sorry, but that might as well be Chinese to me. Please be more specific, what do you mean? I have no two layers, I have no drawing objects at all, I have a series of control point pairs. Quote Link to comment Share on other sites More sharing options...
M76 Posted May 24, 2019 Author Share Posted May 24, 2019 I've tried this, but it has absolutely no effect, things still break down after calling adersheet over 128 times. (setq acadDocument (vla-get-activedocument (vlax-get-acad-object))) (setq ssets (vla-get-selectionsets acadDocument)) (vlax-for item ssets (vla-delete (vla-item ssets (vla-get-name item))) ) Quote Link to comment Share on other sites More sharing options...
dlanorh Posted May 24, 2019 Share Posted May 24, 2019 43 minutes ago, M76 said: I've tried this, but it has absolutely no effect, things still break down after calling adersheet over 128 times. (setq acadDocument (vla-get-activedocument (vlax-get-acad-object))) (setq ssets (vla-get-selectionsets acadDocument)) (vlax-for item ssets (vla-delete (vla-item ssets (vla-get-name item))) ) Try (setq ssets (vla-get-selectionsets (vla-get-activedocument (vlax-get-acad-object)))) (vlax-for item ssets (vla-delete item) ) Quote Link to comment Share on other sites More sharing options...
M76 Posted May 24, 2019 Author Share Posted May 24, 2019 12 minutes ago, dlanorh said: Try (setq ssets (vla-get-selectionsets (vla-get-activedocument (vlax-get-acad-object)))) (vlax-for item ssets (vla-delete item) ) Unfortunately no change, I get the same result. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted May 24, 2019 Share Posted May 24, 2019 I think you miss understood me you want to compare pair of points even if all points are on 1 layer you can do it, its a recursive process, take point 1 compare to all points re distance between, if within tolerance do compare, remove point from master list, get new 1st point and repeat. The code has been done before. I will try to find. For big point numbers a .net style program working on a text file may be a better way to go. Using vlsort you can sort a list of xy co-ord points so comparing two points becomes much easier. A list does have a maximum number it can hold but you could array massive points into smaller lists to get around this problem. Just did a quick test in Briscad and did 100000 items in a list. Can you post a text file of points csv ok, and what tolerance to use. ? Quote Link to comment Share on other sites More sharing options...
BIGAL Posted May 24, 2019 Share Posted May 24, 2019 (edited) Found this fairly recent post sounds like what you want. Edited May 24, 2019 by BIGAL Quote Link to comment Share on other sites More sharing options...
M76 Posted May 25, 2019 Author Share Posted May 25, 2019 (edited) I think you are the one misunderstanding the goal. I don't want to compare existing points to each other. What would that even achieve? Compare how? I want to calculate deviations between neighbouring control points for transformation. So I transform the point in question using the neighbouring points with rubber sheet and then check how well it fits it's control coordinate after transformation. The distance between the transformed point and the control point will give me the deviation of that point compared to it's neighbours. The end result are the deviation numbers, nothing else. This is to check if all points are within tolerances before transforming a Raster image the points correspond to. Edited May 25, 2019 by M76 Quote Link to comment Share on other sites More sharing options...
M76 Posted May 25, 2019 Author Share Posted May 25, 2019 (edited) BTW, I found no solution to this mess. It seems impossible to free up the selection sets used up by adersheet, as they aren't even present in the selectionsets object of currentrawing. if I query the count of selectionsets it returns 0 all the time. Had I known autodesk was so lousy I'd have done this in vba and not lisp. But I always prefer lisp for "easy" tasks. Now I had to figure out a workaround, which took me half a day, and will result in the process running 10 times slower. The only solution I could come up with that actually works is that I removed the loop from the lisp and made it a simple procedure that runs once on one set of control points. This way I can use a script to close and re-open the drawing before each iteration, which frees up sset slots in autocad. Edited May 25, 2019 by M76 Quote Link to comment Share on other sites More sharing options...
rlx Posted May 25, 2019 Share Posted May 25, 2019 (edited) no idea what adersheets are but have your tried the (gc) command yet (garbage collection) , you may have to use after every use of the command. else maybe some good old vanilla (https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-clear-selection-sets/td-p/904012) (defun c:ssclean () (setq ctr 0) (setq lst (atoms-family 1)) (foreach sym lst (if (= (type (eval (read sym))) 'PICKSET) (progn (setq ctr (1+ ctr)) (eval (read (strcat "(setq " sym " nil)"))) (princ (strcat "\nNullified (" (itoa ctr) "): " sym)) ) ) ) (gc) (princ) ) Edited May 25, 2019 by rlx Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.