Notifications
Clear all

[Closed] Detaching and Linking

This code detached my selected faces on Friday, but today it won’t even detach the selected faces. Couldn’t get it to link the detached object to the object it was detached from, or a dummy. help please?

 
convertTo $ PolyMeshObject

--carpaint

the_polyobj = $

the_polyobj.selectbymaterial 13

the_faces = getfaceselection the_polyobj

the_name = execute(the_polyobj.name + "carpaint_" as string)

polyOp.detachFaces the_polyobj the_faces asnode:true name:the_name --detach

the_detached = execute( "$" + the_polyobj.name + "carpaint_" as string)

select the_detached

select $'Site_NSTruck-CPIKUP01_carpaint_'

the_dummy = "$Dummy_" + thepolyobj.name

$.parent = the_dummy

 
1 Reply

could be a typo, but this seems to work:

  
--convertTo $ PolyMeshObject
the_polyobj = selection[1]
setSelectionLevel the_polyobj #face
the_polyobj.selectbymaterial 13
the_faces = getfaceselection the_polyobj
the_name = the_polyobj.name + "carpaint_" as string
polyOp.detachFaces the_polyobj the_faces asnode:true name:the_name
the_detached = execute( "$" + the_polyobj.name + "carpaint_"as string)
--select $'Site_NSTruck-CPIKUP01_carpaint_'
the_dummy = Dummy name:("$Dummy_" + the_polyobj.name as string)
the_detached.parent = the_dummy