SSGET doesn't work. (lselsetp nil)

SSGET doesn't work. (lselsetp nil)

Anonymous
Not applicable
2,506 Views
15 Replies
Message 1 of 16

SSGET doesn't work. (lselsetp nil)

Anonymous
Not applicable

 

This code doesn't work.

 

Even after creating the object "SSGET" doesn't find anything.

 

But if I use "REGEN" in the drawing "SSGET" works.

 

(ssname (ssget "_X" '((0 . "LWPOLYLINE") (8 . "PV-*") (410 . "Model"))) 0)

 

How to fix?!

0 Likes
Accepted solutions (2)
2,507 Views
15 Replies
Replies (15)
Message 2 of 16

Shneuph
Collaborator
Collaborator

Can't replicate the problem.

Your code worked and selected 1 lwpolyline on a PV- layer in model space.  

 

Do you mean to select all of the lwpolylines or just 1?

---sig---------------------------------------
'(83 104 110 101 117 112 104 64 71 109 97 105 108 46 99 111 109)
0 Likes
Message 3 of 16

Anonymous
Not applicable

Just 1.

 

This Polyline, it is created from my code.

But if i dont stop the code for regen the drawing manual, the ssget doesn't work.

 

Sorry for my english.

0 Likes
Message 4 of 16

Shneuph
Collaborator
Collaborator

Any reason why you can't regen the drawing in your code to avoid the problem?

 

(vla-Regen (vla-get-activedocument (vlax-get-acad-object)) acActiveViewport)

---sig---------------------------------------
'(83 104 110 101 117 112 104 64 71 109 97 105 108 46 99 111 109)
0 Likes
Message 5 of 16

Anonymous
Not applicable

I tried everything. Nothing works.

But if I stop the code and simply click on the drawing screen, and then use ssget, it finds.

0 Likes
Message 6 of 16

Ranjit_Singh
Advisor
Advisor

I tried your statement with Layer 0 (which is present in my test drawing) and then with Layer 8 (which isn't present in my test drawing)

 

Command: (ssname (ssget "_X" '((0 . "LWPOLYLINE") (8 . "0*") (410 . "Model"))) 0)
<Entity name: 7ffff5180b0>
Command: (ssname (ssget "_X" '((0 . "LWPOLYLINE") (8 . "8*") (410 . "Model"))) 0)
; error: bad argument type: lselsetp nil

 

You can see the lsetsetp nil error is generated. This error can be generated for many reasons but looking at your code the layer name seems to be something that is a possible culprit. Maybe the layer name your are passing is not yet created when the statement comes into action; but it gets created after you do something (click or regen or whatever). Check your entire code and verify that the layer is in fact present when you pass the ssget filter

 

EDIT: After seeing Kent1Cooper's reply, I now think there are 2 possible culprits. You need to make sure the polyline is present and that it is on the right layer.

0 Likes
Message 7 of 16

Kent1Cooper
Consultant
Consultant

@Anonymous wrote:

.... 

This Polyline, it is created from my code.

....


Can you simply get it with (entlast) or (ssget "_L")?  Or, if it's not the last thing the code has created when you get to where you want to use it, you could save it into a variable with one of those approaches right after creating it, and then use it from the variable later.

Kent Cooper, AIA
0 Likes
Message 8 of 16

Anonymous
Not applicable

I tried all update types

 

 

  (VL-CMDF "REGEN")
  (vla-Regen doc acActiveViewport)
  (vla-Update acadObj)
  (vla-Regen (vla-get-activedocument (vlax-get-acad-object)) acActiveViewport)
  (vla-ZoomAll acadObj)

 

But if I do not stop the code and click on the drawing screen.

It does not update the data with my existing pwpolyline.
In my code it was created before the selection.
In fact I took several lines and turned into Polyline and then wanted to select this polyline.

 

0 Likes
Message 9 of 16

Anonymous
Not applicable

See my answer above.

0 Likes
Message 10 of 16

Kent1Cooper
Consultant
Consultant

@Anonymous wrote:

See my answer above.


The answer above doesn't mention whether you have tried using (entlast) immediately after creating the Polyline.  That would not be subject to any question of whether the Layer name is correct, etc., etc.  I have many routines that draw things internally, after which (entlast) "sees" them without the need to Regen or pick in the screen as you describe.  So if yours doesn't recognize it with (entlast), there's something else odd going on.

 

Can you post the part of the code that creates the Polyline?  There may be something about it that will suggest a reason for the problem.

 

[I was going to wonder whether your PLINETYPE System Variable setting has been changed to 0 somehow.  If it had, and if you created the Polyline using a PLINE command, then it would make a "heavy" Polyline that would not be found with a "LWPOLYLINE" entity-type filter.  But if that were the case, it wouldn't work after Regen or picking on-screen, either, so it doesn't seem likely.]

Kent Cooper, AIA
0 Likes
Message 11 of 16

Anonymous
Not applicable

 

I created a profile (solprof) from a solid and selected it. This profile is created as a object "INSERT".

 

(arxload "acsolids")
  (setq ss (ssget))
  (VL-CMDF "_LAYOUT" "SET" "Layout1" "MSPACE")
  (c:solprof ss "y" "y" "n")  
  (VL-CMDF "_LAYOUT" "SET" "Model")
  (setq profObj (vlax-ename->vla-object (ssname (ssget "_X" '((0 . "INSERT") (8 . "PV-*") (410 . "Model"))) 0)))

Then I exploded the "INSERT", transforming into serveral lines.

 

(setq explodedObjects (vlax-variant-value (vla-Explode profObj)))

Then I joined the lines with:

 

(vla-SendCommand (vla-get-ActiveDocument (vlax-get-acad-object))
  (strcat "JOIN (ssget \"_X\" '((0 . \"LINE\") (8 . \"PV-*\") (410 . \"Model\")))  "))

And that's where the problem occurs. If I click on the drawing screen and use the (entlast) it selects the polyline that has been "joined". But if the code drives it all straight, when it arrives at that part it does not find the line that was "joined".

 

(setq lapPLineEnt (ssname (ssget "_X" '((0 . "LWPOLYLINE") (8 . "PV-*") (410 . "Model"))) 0))

 

 

 

0 Likes
Message 12 of 16

Kent1Cooper
Consultant
Consultant

@Anonymous wrote:

 

.... If I click on the drawing screen and use the (entlast) it selects the polyline that has been "joined". But if the code drives it all straight, when it arrives at that part it does not find the line that was "joined".

 

(setq lapPLineEnt (ssname (ssget "_X" '((0 . "LWPOLYLINE") (8 . "PV-*") (410 . "Model"))) 0))

 


Does

 

(setq lapPLineEnt (entlast))

 

work?

Kent Cooper, AIA
0 Likes
Message 13 of 16

Anonymous
Not applicable

If I run all my code direct does not work.

But we enjoyed it after the mistake.

I click on the drawing screen, and try to inspect (setq lapPLineEnt (entlast)) again, then it works.

0 Likes
Message 14 of 16

marko_ribar
Advisor
Advisor
Accepted solution

Now that you pointed procedure, I suspect it has to do something with this :

 

(vla-SendCommand (vla-get-ActiveDocument (vlax-get-acad-object))
  (strcat "JOIN (ssget \"_X\" '((0 . \"LINE\") (8 . \"PV-*\") (410 . \"Model\")))  "))

vla-SendCommand method works in separate namespace and it's invoked only after all statements from lisp are processed... I strongly suggest that you avoid SendCommand wherever it's possible... Try this instead :

 

(command "_.JOIN" (ssname (ssget "_X" '((0 . "LINE") (8 . "PV-*") (410 . "Model"))) 0) (ssget "_X" '((0 . "LINE") (8 . "PV-*") (410 . "Model"))) "")

Hope this helps, but not 100% sure, some commands are buggy like "_.MESHSMOOTH"...

 

M.R.

Marko Ribar, d.i.a. (graduated engineer of architecture)
0 Likes
Message 15 of 16

Anonymous
Not applicable

Your code doesn't work.. "join" fail.

(command "_.JOIN" (ssname (ssget "_X" '((0 . "LINE") (8 . "PV-*") (410 . "Model"))) 0) (ssget "_X" '((0 . "LINE") (8 . "PV-*") (410 . "Model"))) "")
0 Likes
Message 16 of 16

Anonymous
Not applicable
Accepted solution

Thank you all for your help.

 

I Solved using

 

(command "_.PEDIT" "M" (ssget "_X" '((0 . "LINE") (8 . "PV-*") (410 . "Model"))) "" "JOIN" "" "")

Very Thanks!

0 Likes