Author Topic: get all entities made on the fly  (Read 2525 times)

0 Members and 1 Guest are viewing this topic.

rude dog

  • Guest
get all entities made on the fly
« on: July 17, 2004, 03:12:16 AM »
Let's say you had a line on your screen 125'-6 7/8" E-E
and you wanted to break this one long line into smaller lines, but no longer than.... 10'-0" E-E each (or what ever the user specified)....(which is what my program does) how would you setq each line entity seperatly as its was created ?
any thoughts......
Code: [Select]

(defun c:rl (/ rl sp ep dist rpt lpt)
(prompt "\n*****Routine breaks line into smaller lines....When user sets max length")
(setq rl (getreal "\nType in max length...Decimal form please: "))
(setq esel (car (entsel "\nPick line for function ")))
(setq ent (entget esel))
(setq sp (cdr (assoc 10 ent)))
(setq ep (cdr (assoc 11 ent)))
(setq dist1 (distance sp ep))
(command "erase" esel "")
(if
(<= dist1 rl)
(command "line" sp ep "")
(progn
(command "line" sp (polar sp (angle sp ep) rl) "")(setq lpt (getvar "lastpoint")));progn
);if
(setq dist2 (distance lpt ep))
(if (>= dist2 rl)
(progn
(setq rpt (fix (/ dist2 rl)))
(repeat rpt (command "line" lpt (polar lpt (angle sp ep) rl) "")(setq lpt (getvar "lastpoint")))
);if
);progn
(command "line" lpt ep "")
(prompt "\nLongest line in running length is: ") (rtos rl 4 2)
);defun
(princ)
(prompt "\n***Running Length Routine Loaded!!")

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
get all entities made on the fly
« Reply #1 on: July 17, 2004, 12:21:09 PM »
Well, you could use a new selection set and add each new item to the selection set with ssadd....

Create an empty selection set when the proggie starts:
Code: [Select]

(setq newsset (ssadd))

After each line segment is created:
Code: [Select]

(setq newsset (ssadd (entlast) newsset))


When you need to operate on the lines later, you have an entire selection set....

OR

when the proggie starts grab the last entity in the drawing
Code: [Select]

(setq elast (entlast))


After the last line is created
Code: [Select]

(setq newsset (ssadd))
(while (setq elast (entnext elast))
(setq newsset (ssadd elast newsset))
)


good luck
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

rude dog

  • Guest
get all entities made on the fly
« Reply #2 on: July 17, 2004, 12:29:12 PM »
Thanks for the boost.... :)

rude dog

  • Guest
get all entities made on the fly
« Reply #3 on: July 18, 2004, 12:16:25 AM »
what the....found some bugs with my "proggie" when trying to make a ss set... (more entities  than I anticipated)
back to the lab :oops:

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
get all entities made on the fly
« Reply #4 on: July 18, 2004, 12:25:32 AM »
Sometimes it is like that....
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie