Lisp for selecting some itmes every constant space

Lisp for selecting some itmes every constant space

emadelbatran
Enthusiast Enthusiast
1,006 Views
10 Replies
Message 1 of 11

Lisp for selecting some itmes every constant space

emadelbatran
Enthusiast
Enthusiast

Dear Friends 

I need help from anyone supporting me to select some items  from column or row every constant distance like a picture attached

0 Likes
Accepted solutions (1)
1,007 Views
10 Replies
Replies (10)
Message 2 of 11

RobDraw
Mentor
Mentor

Have you tried the Customization and LISP forum?


Rob

Drafting is a breeze and Revit doesn't always work the way you think it should.
0 Likes
Message 3 of 11

emadelbatran
Enthusiast
Enthusiast

Dear robdraw, thanks for your reply, but I'm not talking about Revit my friend, what all I want is easy may for whos people specialist in lisp creation as I explain in my message above, anyway thank you 

0 Likes
Message 4 of 11

Sea-Haven
Mentor
Mentor

Its not a hard task to draw rectangs in sequence via lisp and say every 3rd having a different colour, you need to provide some size details length, height and gap. 

 

SeaHaven_0-1624859292316.png

 

0 Likes
Message 5 of 11

pbejse
Mentor
Mentor

@emadelbatran wrote:

Dear Friends 

I need help from anyone supporting me to select some items  from column or row every constant distance ..


 

What are these items that you are referring to? A sample drawing is better than an image file.

0 Likes
Message 6 of 11

Sea-Haven
Mentor
Mentor
Accepted solution

oops you want to select no probs just use a ssget "F" option sort the objects and then get every 3rd one. Like Pbe need a dwg. The object type will influence the sort order.

 

A rough start if created in order.

 

 

(setq pt1 (getpoint "\n1st point ")
pt2 (getpoint pt1 "\n2nd point"))
(setq ss (ssget "F" (list pt1 pt2)))
(setq x (sslength ss) inc (getint "\ninter increment spacing "))
(setq num (fix (/ x inc)) lst '())
(setq start (- inc 1))
(setq ss2 (ssadd))
(repeat num
(setq ss2 (ssadd (ssname ss start) ss2))
(setq start (+ start inc))
)
; do something (command "erase" ss2 "")

 

Message 7 of 11

RobDraw
Mentor
Mentor

I pointed you to the correct forum. Your welcome. An admin has moved it your thread for you.

 

You have misinterpreted my signature which appears in all of my responses as a response to you. Of course, I know your question has nothing to do with Revit.


Rob

Drafting is a breeze and Revit doesn't always work the way you think it should.
Message 8 of 11

emadelbatran
Enthusiast
Enthusiast

Here you are dwg example as your request 

0 Likes
Message 9 of 11

emadelbatran
Enthusiast
Enthusiast

Dear @Sea-Haven 

What I'm trying to do is separate some of the emergency lights, each a certain number of headlights. It could be after two, three, or four scouts, and so on...all I need is a lisp. I can modify it to determine the number left.

you will find a new attach dwg example.

frankly, I do not understand the coding you write, may it useful but how I can use it ?? 

thanks a lot for your effort 

 

0 Likes
Message 10 of 11

Sea-Haven
Mentor
Mentor

1st up don;t mark as Solution till your happy it does what you want.

 

Ok 2nd go copy and paste into notepad and save as say getpart.lsp, next find help about running lisp programs. As a start can drag and drop using explorer.

 

3rd it will select the items based on position you nominate.

 

SeaHaven_0-1624940055090.png

 

SeaHaven_1-1624940180325.png

You have not said what you want to do with the result the code stores it as a selection set LST, so erase !lst would rub them out.

 

 

; simple get objects in using a line selecting by order
; By AlanH June 2021

(defun c:getpart ( / pt1 pt2 ss num)
(setq pt1 (getpoint "\n1st point ")
pt2 (getpoint pt1 "\n2nd point"))
(setq ss (ssget "F" (list pt1 pt2)))
(setq x (sslength ss) inc (getint "\nEnter increment spacing "))
(setq num (fix (/ x inc)) lst '())
(setq start (- inc 1))
(setq lst (ssadd))
(repeat num
(setq lst (ssadd (ssname ss start) lst))
(setq start (+ start inc))
)
(princ)
)

(c:getpart)

 

 

 

 

Message 11 of 11

emadelbatran
Enthusiast
Enthusiast

Thank you @Sea-Haven  very much for your help and your advice, Just I have one remaining for you is to explain how's your LSP work. because I tried to do it but there's nothing happen .

What I did ..select the first light from down and the first one from up as you write 1st and 2nd into your LSP and the number in increment space.

0 Likes