Jump to content

ADERSHEET creates unerasable selection sets


M76

Recommended Posts

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.

Link to comment
Share on other sites

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 by dlanorh
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 by M76
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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)))
		 )

 

 

Link to comment
Share on other sites

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)
)

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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. ?

Link to comment
Share on other sites

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 by M76
Link to comment
Share on other sites

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 by M76
Link to comment
Share on other sites

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 by rlx
Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...