lastknownuser Posted March 4, 2022 Posted March 4, 2022 I need help, can't figure this out (if its even possible) I would like to code the single left mouse select (selecting block for example) I have a variable BLOCK as <Entity name: 716eedb0> (one block from from selection set) When I write in command bar "SELECT" "!BLOCK" and press enter it selects that block and shows me properties of it in properties tab. How could I write that action as code in lisp? The idea is to go through all the blocks in selection set, and as I go I want to see the properties of each one of them Quote
mhupp Posted March 4, 2022 Posted March 4, 2022 (edited) ;;----------------------------------------------------------------------------;; ;; Dump all DXF Group Data (defun c:DumpIt (/ e) (if (setq SS (ssget)) (foreach ent (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss))) ;list and steps through all entitys in selection set (mapcar 'print (entget ent '( "*"))) ) ) (textscr) (princ) ) This pulls the entity name of anything you select with the mouse. (setq blk (car (entsel "\nSelect Block"))) sssetfirst highlights selection set but you can just pick one entity (sssetfirst nil (ssget)) or by ssname (sssetfirst nil SS) Edited March 4, 2022 by mhupp 2 Quote
tombu Posted March 4, 2022 Posted March 4, 2022 You can add modes to SSGET to make it look and act like you'd expect selecting a single object. (sssetfirst nil (ssget "+.:E:S")) Code reference by Lee Mac: http://www.lee-mac.com/ssget.html 1 Quote
BIGAL Posted March 4, 2022 Posted March 4, 2022 My $0.05 (while (setq ent (entsel "\npick object enter to exit"))(princ (entget (car ent)))) Quote
lastknownuser Posted March 7, 2022 Author Posted March 7, 2022 (edited) On 04/03/2022 at 15:29, mhupp said: This pulls the entity name of anything you select with the mouse. (setq blk (car (entsel "\nSelect Block"))) sssetfirst highlights selection set but you can just pick one entity (sssetfirst nil (ssget)) or by ssname (sssetfirst nil SS) Did you ment to wite "but you CAN'T just pick one entity" ? Becase that is actually what I am trying to do. I can't select single entity name (blk) with sssetfirst. Is there maybe a way to create a new selection set with just one entity (in this case blk variable)? EDIT: I figured it out! Here is what I did, example for first entity from SS, created new single entity selection set and it selects only that block (setq SS2 (ssadd)) (setq ent (ssname SS 0)) (ssadd ent SS2) (sssetfirst nil SS2) Thanks for help! Edited March 7, 2022 by lastknownuser I found the solution to my problem Quote
tombu Posted March 7, 2022 Posted March 7, 2022 9 hours ago, lastknownuser said: EDIT: I figured it out! Here is what I did, example for first entity from SS, created new single entity selection set and it selects only that block (setq SS2 (ssadd)) (setq ent (ssname SS 0)) (ssadd ent SS2) (sssetfirst nil SS2) Problem with that is you may still select multiple items. Then listing just the first object in the selection set seems random. Why not select a single object for the selection set to begin with? (sssetfirst nil (ssget "+.:E:S")) Try the code in my previous post. It included a link that explains how it works. Quote
lastknownuser Posted March 7, 2022 Author Posted March 7, 2022 1 hour ago, tombu said: Problem with that is you may still select multiple items. Then listing just the first object in the selection set seems random. Why not select a single object for the selection set to begin with? (sssetfirst nil (ssget "+.:E:S")) Try the code in my previous post. It included a link that explains how it works. Maybe I didn't explain it specifically as I should. I wanted to code the left mouse click action on the block - without clicking on the block. I won't select multiple items since I have a list of all block entities from a selection set. I created a button to zoom the next block in list, but I also wanted to see the properties (in the properties tab) of that next block, and that was achieved using the sssetfirst function Quote
mhupp Posted March 7, 2022 Posted March 7, 2022 4 hours ago, lastknownuser said: I won't select multiple items since I have a list of all block entities from a selection set. I created a button to zoom the next block in list post your code or modify it to add the following. (setq SS1 (ssadd)) ;ss1 needs to be defined before you can add entitys to it. add somewhere in the start. ;point in your code when you zooming to blocks (ssadd "entity name" SS1) ;add to SS1 (sssetfirst nil SS1) ;you know what this does (command "_.Zoom" "OB") ;Zoom to object that is currently selected from sssetfirst (ssdel "entity name" SS1) ;remove from ss1 so next block will be the only thing in ss1 ...continue your code. Quote
lastknownuser Posted March 8, 2022 Author Posted March 8, 2022 7 hours ago, mhupp said: post your code or modify it to add the following. (setq SS1 (ssadd)) ;ss1 needs to be defined before you can add entitys to it. add somewhere in the start. ;point in your code when you zooming to blocks (ssadd "entity name" SS1) ;add to SS1 (sssetfirst nil SS1) ;you know what this does (command "_.Zoom" "OB") ;Zoom to object that is currently selected from sssetfirst (ssdel "entity name" SS1) ;remove from ss1 so next block will be the only thing in ss1 ...continue your code. As I have said, I got it working like I want to. This is a part of a bigger program and I am using Open DCL so I won't post the whole code, but here is what I have, I'll try to be as specific as I can List (ENTlst) from sset, first element entity, second is block coordinates ((<Entity name: 62946530> "125.03,112.60,0.00" ) (<Entity name: 62946470> "119.50,117.68,0.00") ...) From that I extract for each block entity and coordinates: (setq ENT (nth 0 ENTlst)) (setq COORD (nth 1 ENTlst)) Then I create each time new sset: (setq SS2 (ssadd)) And add ENT to it: (ssadd ENT SS2) And finally the result what I wanted: (command "zoom" "c" COORD "20") (sssetfirst nil SS2) Quote
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.