Notifications
Clear all

[Closed] Substitute modifier not working in script?

Hi,

I’m writting a script to replace 2d door blocks with a referenced “pivot door”. Basically I want all 2d blocks (from AutoCAD) named “Block:XDR-SL-36x8x80” to be replaced by a “pivot door” I create using the same sizes (36″wide, 8″dp, 80″ high). The problem is I’m using a substitute modifier and it is writting the correct name of the replacer object in the substitute dialogue box but not actually substituting the object! Am I missing a step here?

DoorRef = $ —This is my selected pivot door I want to use to use as the replacer object
$.name = “REF-SL-36x8x80” — I rename the object to this
select DoorJamb — This is the selected 2d block I want to add the substitute modifer to
modPanel.addModToSelection (Substitute ()) ui:on
$.modifiers[#Substitute].objectName = DoorRef.name
$.modifiers[#Substitute].SubstituteType = “Type: Instance”

Thanks,
Billibong

3 Replies

Billibong,

You forgot to set the actual reference to the object:

$.modifiers[#Substitute].objectreference = DoorRef

Cheers,
Martijn

Thanks,

That works, the wierd thing is that line doesn’t appear in the Maxscript listener window when I do a substitute manually.

Thanks Again,
billibong

A very quick way to get help about a certain command in maxscript is to put your text caret somewhere on a word (like substitute) and press F1. it will take you to the right topic very quickly

  • Martijn