hi friends
i need help ~
pls pls pls
i would like to set block type.
i tried this way
ce.setAttribute(block,'/ce/block/SKELETON',2)
ce.setAttribute(block,'/ce/block/RECURSIVE',0)
but not working .
how can i set block type with python ?
Solved! Go to Solution.
Hi @JeoCho,
The attribute is "/ce/block/type"
And the possible values are:
"Skeleton Subdivision", "Recursive Subdivision", ... (Same as in the inspector)
If the attribute is not shown as bold in the inspector you need to not only set the value of the attribute you also need to set the source of the attribute to user.
Here is an example, I adapted it from the python docs to match your case
block = ce.getObjectsFrom(ce.selection)[0]
ce.setAttribute(block,"/ce/block/type", "Offset Subdivision")
ce.setAttributeSource(block,"/ce/block/type", "USER")
Hope this helps!
Best,
Jonas
Hi again,
Sure this is also possible. You just need to change your filter from ce.isgeneratedModel (this is no valid filter!) to ce.isModel. And then select it using ce.setSelection()
# all generated models in scene
models = ce.getObjectsFrom(ce.scene, ce.isModel)
ce.setSelection (models)
Shapes which have a rule file assigned but aren't generated won't be included in the ce.isModel filter.
cheers
Jonas
Hi @JeoCho,
The attribute is "/ce/block/type"
And the possible values are:
"Skeleton Subdivision", "Recursive Subdivision", ... (Same as in the inspector)
If the attribute is not shown as bold in the inspector you need to not only set the value of the attribute you also need to set the source of the attribute to user.
Here is an example, I adapted it from the python docs to match your case
block = ce.getObjectsFrom(ce.selection)[0]
ce.setAttribute(block,"/ce/block/type", "Offset Subdivision")
ce.setAttributeSource(block,"/ce/block/type", "USER")
Hope this helps!
Best,
Jonas
Wow wow
Really thank you , really thank you
Sorry , can i question one more ?
models = ce.getObjectsFrom(ce.scene , ce.isgeneratedModel)
I generate model in a certain block
And i would like to select genrated model only
Like this
models = ce.getObjectsFrom(ce.scene , ce.isgeneratedModel)
Is that possible ?
Sorry many ask
Hi again,
Sure this is also possible. You just need to change your filter from ce.isgeneratedModel (this is no valid filter!) to ce.isModel. And then select it using ce.setSelection()
# all generated models in scene
models = ce.getObjectsFrom(ce.scene, ce.isModel)
ce.setSelection (models)
Shapes which have a rule file assigned but aren't generated won't be included in the ce.isModel filter.
cheers
Jonas
really really thank thank thank you for answering
i made this script
but error,
really really sorry , pls can you check this 2 script
1. this is script to select ( select generated model in selected block)
but error
from scripting import *
ce = CE()
def selectblock() :
oneblock = ce.getObjectsFrom(ce.selection, ce.isBlock)
lots = ce.getObjectsFrom(oneblock[0] , ce.ismodel)
ce.setSelection(lots)
if __name__ == '__main__':
selectblock()
2 this is layer isolate script
that is error also
from scripting import *
ce = CE()
@noUIupdate
def main():
sele = ce.getObjectsFrom(ce.selection, ce.isLayer)
layers = ce.getObjectsFrom(ce.scene, ce.isLayer)
for layer in layers:
really really sorry sorry for many ask
layer.setVisible(False)
if sele :
sele.setVisible(True)
if __name__ == '__main__':
main()
Hi again,
First script:
Second script:
Some general advice:
Best,
Jonas
Thank you
Thank you.
thank you