Author Topic: Select by kind of object  (Read 15617 times)

Offline dh42

  • Administrator
  • CNC Jedi
  • *****
  • Posts: 6211
    • View Profile
    • Cambam V1.0 French Doc
Re: Select by kind of object
« Reply #30 on: December 20, 2017, 21:37:24 pm »

Offline Dragonfly

  • CNC Jedi
  • *****
  • Posts: 2383
    • View Profile
Re: Select by kind of object
« Reply #31 on: December 20, 2017, 21:58:11 pm »
Already tried and it works.

Special thanks, again!

Offline Dragonfly

  • CNC Jedi
  • *****
  • Posts: 2383
    • View Profile
Re: Select by kind of object
« Reply #32 on: August 04, 2020, 17:26:11 pm »
Anywhere within your script, add this line...

Code: [Select]
CamBamConfig.Defaults.ReloadTreeAfterScript = false

Normally, after a script has finished executing some code is run to reload the drawing tree view (in case the script has changed anything within the drawing).
ReloadTreeAfterScript = false will prevent this happening, so your selections will stay in place.

I also notice the 'after script' code also does a view.RefreshView(), so you could also leave out that line in your script.

The ReloadTreeAfterScript property is not saved in the configuration file, so the next time CamBam is restarted it's value will revert back to 'True'.

Sorry about that one!  :-[

Change this line...

Code: [Select]
view.Select(newselection.ToArray())
to
Code: [Select]
view.Select(newselection.ToArray(GetType(Entity)))

OR,
you can change

Code: [Select]
dim newselection as ArrayList = new ArrayList()
to
Code: [Select]
dim newselection as Generic.List(of Entity) = new Generic.List(of Entity)()

but not both!  ;)

Alleluia!  :)
I knew I've seen a clue how to make a selection editable after a script is used to select objects by some criteria.
Took me half a day of searching though.

Now, if someone can show me how those lists of entity are initialized in Python ...  ::)
« Last Edit: August 05, 2020, 05:30:51 am by dh42 »

Offline dh42

  • Administrator
  • CNC Jedi
  • *****
  • Posts: 6211
    • View Profile
    • Cambam V1.0 French Doc
Re: Select by kind of object
« Reply #33 on: August 05, 2020, 05:38:44 am »
Hello

We also talk about this a few month ago here

https://cambamcnc.com/forum/index.php?topic=8488.msg67361#msg67361

But I've no idea for the python syntax ... sorry.

I'll add this tips to the snippet page ;) it can be useful for others ;)

++
David