DesignCAD 3D Max 2027 box
Now available

DesignCAD 2027

Hatches that follow their boundaries, an on-screen dial to turn your model, and a way to find any command by name, in a clean Windows 11 look.

Macro to delete everything except the selected entities

Started by GooPie, February 25, 2015, 01:42:24 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

GooPie

Hello,
Still need help.

All is in the title.
The following macro (no interest except to learn) works but it's not very pretty.

When I select by drag I would have a tape. I do not know how. (See red code).

----------------------------------------------------------------------------------------

' Macro Dragselect Delete

SYS(80) = 0
' SYS(80) = number of selected entity

SYS(470) = 1
'No command when a macro is launched On/Off [1, 0]

SYS(996) = 1
' Exit by pressing the ESC key

FOR J = 0 to 1000
LAYER(J)=6
NEXT J
' All layers are visible and editable

REGEN
'Regenerate the drawing

' :o
'SYS(41) = 1
'SYS(41) = Type elastic feature [0 = no, 1 = Line, 13 = Map]

' :o

>DragSelect
{
  }

>SelectDelete
{
  }

REGEN
'Regenerate the drawing

END

----------------------------------------------------------------------------------------

I want to make exactly the opposite of what fact the previous macro.
It would be much more interesting.  8)

Thank you for your help.

GooPie

GooPie

For information I use the French version of DesignCad Pro 6000.
I do not know what it is with "imsidesign"

prl

Hmmm, an inverted selection routine.

Try this as a starting point.

Quote'Program: eis.d3m (erase inverted selection)

'a made-up test program.   May not work.

sys(36)=2
include "dcadalias.d3i"

for j = 1 to sys(9)
  entity j
  query Ent_Selected, eselected
 
  if eselected = 0 then
     change Ent_Selected, 1
  else
     change Ent_Selected, 0
  endif
 
next j


sys(1)=0
sys(80)=0
>selectprevious
{
}

if sys(80)>0 then
  >erase
  {
  }
endif

sys(36)=0
regen


End       

GooPie

Hello prl

A very good starting point.
Something with the command "SectionCopy" would be better for me.
For large drawing a progress bar would be fun.

Some changes in red
Blue a few comments or questions

'Program: inverts.d3m (invert selection)

'a made-up test program.   May not work.
'It work


include "dcadalias.d3i"

IF SYS(80) = 0 THEN

MESSAGE "Select entities before use"

END

END IF


sys(36)=1
'sys(36) = Silent Mode On / Off [1, 0]
'What is option 2 ? I don't have this option in my DesignCAD


for j = 1 to sys(9)
  entity j
  query Ent_Selected, eselected
 
  if eselected = 0 then
     change Ent_Selected, 1
  else
     change Ent_Selected, 0
  endif
 
next j

sys(36)=0
sys(1)=0
sys(80)=0
>selectprevious
{
}

if sys(80)>0 then
  >erase
  {
  }
endif

>FitToWindow
{
  }

MESSAGE "Done"


End


Have a nice day.



prl

Quote from: GooPie on February 25, 2015, 11:32:24 PM
'What is option 2 ? I don't have this option in my DesignCAD[/color]


Quote36 - Silent mode (0=normal operation, 1=silent mode, 2=extra-silent mode)

In silent mode, the screen does not automatically show the points you set, or update the drawing screen as frequently. This mode is used for greater speed when your macro has complete control of the program and you are not expecting user input.
Silent mode 2 completely suppresses view regeneration and drawing command dialog boxes when you draw entities.
Note: After performing any drawing operations in Silent Mode 2, you will need to manually regenerate the screen after setting Silent Mode back to zero.
Note: You should always return silent mode to zero when your macro exits. Failure to do so may result in improper manual operation of DesignCAD.

GooPie,  the latest (and last reference) file for BasicCAD is here: http://www.fyrissia.com/drolltroll/dcdevkit/macros17.zip

And to view the *.hlp file in newer versions of Windows (7, 8, etc.), see this topic: http://forum.designcad.com/index.php?topic=5508.0