[Closed] Help with simple script
Hi all
I have numerous imported meshes that I would like to clean up a bit. They are imported as Editable Meshes non welded. So I tried to do a macro script by using the listener to record, and I came up with this:
select $SIEMENS_LIGHT_RED001
actionMan.executeAction 0 “369” – Views: View Edged Faces Toggle
clearSelection()
select $613
clearSelection()
select #($613, $G_NSD0_XX_91022V_TUBE001)
macros.run “Modifier Stack” “SubObject_1”
clearSelection()
select $G_NSD0_XX_91022V_TUBE001
macros.run “Modifier Stack” “SubObject_1”
actionMan.executeAction 0 “40021”
$.EditablePoly.SetSelection #Vertex #{1…264}
$.weldThreshold = 0.000393701
$.EditablePoly.weldFlaggedVertices ()
subobjectLevel = 0
actionMan.executeAction 0 “369” – Views: View Edged Faces Toggle
modPanel.addModToSelection (smooth ()) ui:on
$.modifiers[#Smooth].autosmooth = on
macros.run “Modifier Stack” “Convert_to_Poly”
clearSelection()
Basically what I want to do with this is:
With my parts selected
Convert to EP
Vertex level
Select All
Weld (thr.hold 0.01mm)
Toplevel
Quadrify All
Smooth modifier
AutoSmooth
Convert to EP
Can anyone take a look at my script and maybe point me in the right direction? Thanks in advance.
/M
do you want to attach parts together and weld after that?
what Quad Size do you want to set?
how many Iterations for TurboSmooth do you want?
Hi Denis!
Once again you come to my aid!!! Thanks!
No I don´t want them attached, kept as seperate objects
Quadsize, hrmm I just press the Quadrify All button on the Graphite toolbar. Can´t find any settings…
I would like the Smooth modifier with the Autosmooth enabled. these parts are not ready to be turbosmoothed (yet)
Much appreciated Denis!
Take care
/M
--if you want to attach:
with redraw off
(
nodes = for node in selection where iskindof node GeometryClass collect converttomesh node
main = nodes[1]
for k=2 to nodes.count do attach main nodes[k]
meshop.weldVertsByThreshold main main.verts (units.decodevalue "0.01mm")
addmodifier main (QuadMesh quadsize:4)
addmodifier main (TurboSmooth iterations:1)
converttopoly main
main
)
--if you don't want to attach:
with redraw off
(
nodes = for node in selection where iskindof node GeometryClass collect
(
converttomesh node
meshop.weldVertsByThreshold node node.verts (units.decodevalue "0.01mm")
node
)
addmodifier nodes (QuadMesh quadsize:4)
addmodifier nodes (TurboSmooth iterations:1)
converttopoly nodes
nodes
)
-- what you want:
with redraw off
(
setCommandPanelTaskMode mode:#modify
for node in (selection as array) where iskindof node GeometryClass collect
(
converttopoly node
node.weldThreshold = units.decodevalue "0.01mm"
polyop.weldVertsByThreshold node node.verts
select node
modpanel.setcurrentobject node -- not really necessary
PolyBQuadrify off off
modpanel.addmodtoselection (Smooth autosmooth:on)
converttopoly node
)
)
Ahhh man, that is sooo freakin´ schweet… Thank u so much
Next time I´m in NY, I´ll buy you a LOT of beers, we get drunk, you hire me, I move to NY and we live happily ever after… Sounds like a plan too me!!!
Thanks D!
here is a PRO version (much faster and no flickering):
with redraw off
(
windows.sendmessage (windows.getmaxhwnd()) 0x000B 0 1
setCommandPanelTaskMode mode:#modify
disableRefMsgs()
nodes = for node in (selection as array) where iskindof node GeometryClass collect
(
converttopoly node
node.weldThreshold = units.decodevalue "0.01mm"
polyop.weldVertsByThreshold node node.verts
select node
modpanel.setcurrentobject node
PolyBQuadrify off off
modpanel.addmodtoselection (Smooth autosmooth:on threshold:30)
converttopoly node
)
enableRefMsgs()
windows.sendmessage (windows.getmaxhwnd()) 0x000B 1 1
select nodes
nodes
)