Author Topic: change layers routine  (Read 1651 times)

0 Members and 1 Guest are viewing this topic.

Fabricio28

  • Swamp Rat
  • Posts: 670
change layers routine
« on: May 09, 2013, 11:26:08 AM »
Hi,
I have a routine to change to another layer just taking a piece of the name, I've tried several things with no success. But I found a routine that does, so I'm creating a routine to invoke it.

The routine invoke for the prompt, the text I want to search in layers, then asks that I bring layer.

the command is: mudarlayer but I'm trying create a command with this command already loaded with the routine, but it is not working.

Code: [Select]
(COMMAND "MUDARLAYER" "TEST" "DOTO-ARCHITECTURE" "")
it seems that the command only work with autocad commands, in this case What do I do to invoke the command to another routine?

Taking into consideration that I will repeat several times, just one invoke will execute various routines.


Sorry for my poor english.

Regards.
Fabricio
« Last Edit: May 09, 2013, 11:34:56 AM by FABRICIO28 »

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: change layers routine
« Reply #1 on: May 09, 2013, 02:59:30 PM »
You would either have to restructure the routine to be a subroutine, which would accept variables or use vla-sendcommand.

eg.
Code: [Select]
(vla-sendcommand
  (vla-get-activedocument (vlax-get-acad-object))
  "MUDARLAYER TEST DOTO-ARCHITECTURE  "
)
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: change layers routine
« Reply #2 on: May 09, 2013, 03:01:00 PM »
Actually, since the getstring function, with it set to accept spaces, the above could be an issue. Try this:

Code: [Select]
(vla-sendcommand
  (vla-get-activedocument (vlax-get-acad-object))
  "MUDARLAYER\nTEST\nDOTO-ARCHITECTURE\n\n"
)
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

Fabricio28

  • Swamp Rat
  • Posts: 670
Re: change layers routine
« Reply #3 on: May 10, 2013, 10:52:15 AM »
Thanks for replay alan,

I got it. I have to convert in a function, so this can be read.

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: change layers routine
« Reply #4 on: May 13, 2013, 07:54:35 AM »
Thanks for replay alan,

I got it. I have to convert in a function, so this can be read.
That's always the better option. The above is only a last resort.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox