Author Topic: Predefine Area to select objects  (Read 2111 times)

0 Members and 1 Guest are viewing this topic.

MSTG007

  • Gator
  • Posts: 2601
  • I can't remeber what I already asked! I need help!
Predefine Area to select objects
« on: May 07, 2015, 05:28:53 PM »
This is just an idea. Lets say I have several lisp routines that do different things; but I would want the user to have no interaction with selecting objects / or windowing areas to select. How could that be possible?

For Example
Delete Objects within a window area (similar to erase objects within a polyline).

Make a block change all its entities to Layer 0 and bylayer (Typically the user would then go pick the object). Could that pick be pre-defined?

Any advice would be awesome! Thanks again.
Civil3D 2020

mjfarrell

  • Seagull
  • Posts: 14444
  • Every Student their own Lesson
Re: Predefine Area to select objects
« Reply #1 on: May 07, 2015, 05:50:59 PM »
not that I know anything...

how would you 'always' know what area the data to be change would be at in a drawing?
Be your Best


Michael Farrell
http://primeservicesglobal.com/

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Predefine Area to select objects
« Reply #2 on: May 07, 2015, 05:59:42 PM »
Delete Objects within a window area (similar to erase objects within a polyline).

The following simple function will erase all objects within a window selection defined by the two supplied points:
Code - Auto/Visual Lisp: [Select]
  1. (defun delwin ( pt1 pt2 / app idx pt3 sel )
  2.           pt3 (mapcar 'min pt1 pt2)
  3.           pt2 (mapcar 'max pt1 pt2)
  4.           pt1 pt3
  5.     )
  6.     (if (setq sel (ssget "_W" pt1 pt2))
  7.         (repeat (setq idx (sslength sel))
  8.             (entdel (ssname sel (setq idx (1- idx))))
  9.         )
  10.     )
  11.     (vla-zoomprevious app)
  12.     (princ)
  13. )
For example, to delete all objects within the window spanning from '(1 2) to '(3 4):
Code - Auto/Visual Lisp: [Select]
  1. (delwin '(1 2) '(3 4))

My ssget function reference may help you in this regard.

Make a block change all its entities to Layer 0 and bylayer (Typically the user would then go pick the object). Could that pick be pre-defined?

For this task no selection is required since the modifications would be performed on the objects contained within the block definition, not the block reference inserted in the drawing; such changes would then be reflected across all inserted block references following a regen.

MSTG007

  • Gator
  • Posts: 2601
  • I can't remeber what I already asked! I need help!
Re: Predefine Area to select objects
« Reply #3 on: May 07, 2015, 07:16:55 PM »
Off the wall question. What do you do when you when using the ssx and by block name command filter. Then say erase previous but the block still resides or not deleted.
Civil3D 2020