Notifications
Clear all

[Closed] section shape

a small question concerning the section shape:
From the UI you can get a spline out of a section shape in two way. Either you press the ‘Create shape’ button, or you can convert the section into a spline. The first gives you a nice, clean spline, with one vertex for each sectioned edge. The second gives you much more vertices and many separate splines (where the first would give you only one).
Now in maxscript I can do the second using convertToSplineShape. Is there a way to get the results that the ‘Create Shape’ button is giving, through maxscript? Or do I have to start looking for a way to weld the vertices??

Thanks

4 Replies

If you want to press a button – just do it!


fn createSectionShape = if iskindof (modpanel.getCurrentObject()) Section do 
(
	last = objects[objects.count]
	fn pressButton hwnd: name:"OK" = 
	(
		if hwnd == unsupplied do hwnd = DialogMonitorOPS.GetWindowHandle()
		UIAccessor.PressButtonByName hwnd name
	)
	if (hwnd = windows.getchildhwnd #max "Create Shape") != undefined do
	(
		DialogMonitorOPS.unRegisterNotification id:#sectionShape
		DialogMonitorOPS.RegisterNotification pressButton id:#sectionShape
		DialogMonitorOPS.Enabled = on
		UIAccessor.PressButton hwnd[1]
		DialogMonitorOPS.unRegisterNotification id:#sectionShape
		DialogMonitorOPS.Enabled = off
		if (new = objects[objects.count]) != last do new
	)
)
   

Enjoy!

PS. Technically it is possible to set a name for new shape in pop-up dialog but … it will be too much

Thanks a lot! However I have to admit that you completely lost me on this one :). I guess that you are virtually pressing the button(s) through the script? I have to test it! (i might be back with some questions thought ;))
Thanks again

If you prefer to weld vertices after conversion you can do it.

1 Reply
(@rafoarc)
Joined: 11 months ago

Posts: 0

you didn’t loose anything! I did ;). i just didn’t understand exactly what you are doing in the script… (and unfortunately I can not test it right now). But I definitely do not want to weld vertices, so I am going to test it soon…