i want to use the CubitInterface::parse_cubit_list in my custom command. But i can`t get the desired syntax working to get 1 string that i can put into the parser.
i want to have an command input like “block all except 1 3 5 element type hex20” but i can only get it work when i use quotes for my string data type. so the input would end up like “block ‘all except 1 3 5’ element type hex20”
i already tried to change the number attribute from my string data but cubit always throws me an invalid command error.
how should the syntax look to get an string or an vector that i can use for the parser?
You have to break that out into two commands. The parse_cubit_list method doesn’t know how to parse “element type hex20”
# get the block ids
block_ids = cubit.parse_cubit_list("block", "all except 1 3 5")
# convert the tuple into a space separated list. Note the single quotes inside the double quoted string
cubit.cmd( f" block {' '.join([str(i) for i in block_ids]) } element type hex20")
what changes to the syntax must be made so that the command “ccx block all except 1 3 5 element_type c3d20” will also work and not just the quoted version “ccx block ‘all except 1 3 5’ element_type c3d20” ?
Hi Karl,
i tried it, but i only got it working if the input were numbers.
I already made a little workaround to fix this, with more syntax lines for the command and then checking for keywords in the execude.