Attaching objects by list

Hi guys, anyone kindly guide me on how to attach multiple objects to an editable poly, without making a selection in the viewport, but attaching them by list. Any help highly appreciated. thanks

ps. I've gone through previous similar posts but couldn't get a similar scenario.

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
thekevnn's picture

hey barigazy, I finally got

hey barigazy,
I finally got it working. you were right, attachlist is a bit complicated so I'm using the first method. It looked intimidating at first but I've managed to figure most of it out, maybe coz I'm a n00b. I appreciate the help… ill be posting the script once I'm done. cheers!

barigazy's picture
barigazy's picture

Try this

fn geoFilter obj = isKindOf obj geometryClass and not isKindOf obj TargetObject
fn attachSelections nodesArr = if isKindOf nodesArr array and nodesArr.count >1 do
(
	local cnt = 1
	local poAttach = polyop.attach
	if not isKindOf nodesArr[1] Editable_Poly do convertToPoly nodesArr[1]
	while nodesArr.count > 1 do
	(
		cnt += 1
		poAttach nodesArr[cnt-1] nodesArr[cnt]
		deleteItem nodesArr cnt
		if cnt >= nodesArr.count do cnt = 1
	) ; nodesArr[1]
)
theObjs = selectByName title:"Select Objects" buttonText:"Attach!" filter:geoFilter showHidden:true single:false
attachSelections theObjs

bga

thekevnn's picture

thanks barigazy, I'll try &

thanks barigazy, I'll try & decipher that into my macroscript. i'll provide some feedback soon as I'm done. thanks alot

barigazy's picture

my pleasure :)

my pleasure :)

bga

thekevnn's picture

FEEDback

hello barigazy, I've tried to implement your script utilizing 'iskindof' function but I'm miserably lost. However I came across this in the 3ds maxscript help docs. under Attach/Detach methods>

AttachList <&node array>nodesToAttach editPolyNode:

...when I attempt to use AttachList as outlined in the document I get syntax error. please advise. thanks in advance

barigazy's picture

AttachList method is

AttachList method is interface operation of Edit_Poly modifier
To perform this operation you need to be in modifier panel.
This is the first of many disadvantage.Use my method (fester for sure).
example editPoly attach list method:

boxObj = Box isSelected:on
addmodifier boxObj (Edit_Poly())
sphObj1 = Sphere pos:[-30,30,0] radius:5
sphObj2 = Sphere pos:[30,-30, 0] radius:5
sphArr = #(sphObj1,sphObj2)
max modify mode -- if u use "max create mode" then code not works
boxObj.Edit_Poly.AttachList &sphArr editPolyNode:boxObj

bga

thekevnn's picture

Thanks

hey barigazy,
I finally got it working. you were right, attachlist is a bit complicated so I'm using the first method. It looked intimidating at first but I've managed to figure most of it out, maybe coz I'm a n00b. I appreciate the help… ill be posting the script once I'm done. cheers!

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.