Announcements

Starting in December, we will archive content from the community that is 10 years and older. This FAQ provides more information.

Community
3ds Max Programming
Welcome to Autodesk’s 3ds Max Forums. Share your knowledge, ask questions, and explore popular 3ds Max SDK, Maxscript and Python topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Using MAXScript to create a house?

13 REPLIES 13
Reply
Message 1 of 14
jeffmorris
1687 Views, 13 Replies

Using MAXScript to create a house?

I want to write MAXScript file to create 3D models of houses after I enter number of floors, length, and width in a dialog box. How do I create a dialog box? Is there a different kind of extrude command? One end of the house is open instead of closed. Is there a different way of drawing the house shape before extruding it? Are there good written tutorials on MAXScript?

13 REPLIES 13
Message 2 of 14
MedalHellWay
in reply to: jeffmorris

From Autodesk 3dsmax Learning Channel:

 

https://www.youtube.com/watch?v=kc1lZ7fyaqs&list=PLnKw1txyYzRmwWJ1K7tlBSjiy42YVZ86K

 

Here use of a free script called Building Maker 😉

Message 3 of 14
MedalHellWay
in reply to: jeffmorris

Ok, In addition to the advice that I have stated above, I have created a script for you called "Quick Create House". See if you can be helpful and studies the creation code 🙂

 

Message 4 of 14
jeffmorris
in reply to: MedalHellWay

Thank you very much for the CreateQuickHouse script. I made some changes to the script so that I got it working the way I want. How do I have the script create the house where I click in the 3D world?

Message 5 of 14
MedalHellWay
in reply to: jeffmorris

Yes, you can; find on maxscript help "mouse tools"
Message 6 of 14
jeffmorris
in reply to: MedalHellWay

How can I use mouse tools in my script? What about pickpoint()? How can I break Point3 into three separate parts and put the parts into the below line?

 

pl = Plane length:floorheight1 width:sp_width.value pos:[0,0,floorheight2] isSelected:on widthsegs:1 lengthsegs:1

Message 7 of 14
MedalHellWay
in reply to: jeffmorris

See "Scripted Mouse Tools" in help and follow more example to use the mouse tool. Sorry, but I don't never used MT, but the example are meaning...
Message 8 of 14
MedalHellWay
in reply to: jeffmorris

Mmmhhh try this but it is to be fix... more than this I don't know :D

 

	on bt_create pressed do 
	(
		tool create
(

on mousePoint clickno do
if clickno == 1 then createHouse() else #stop
on mouseMove clickno do pl.pos = gridPoint
)
startTool create
	)

 

Message 9 of 14
jeffmorris
in reply to: MedalHellWay

I think I got the script working. In the MAXScript Help, there is a function that finds angle of a line between two points. I would like to make two clicks, find angle of a line between two points, and draw a house at an angle. Will this work?

 

Vector Dot Product

dot <point3> <point3>

Returns the vector dot product.

The geometric interpretation of the dot product is the length of the projection of the first vector onto the unit vector of the second vector. Obviously, when the two vectors are perpendicular, the dot product is 0.0.

The dot product is commutative, which means that dot X Y == dot Y X.

The dot product is associative, which means that dot (r*X) Y == r*(dot X Y).

The dot product is distributive, which means that dot X (Y+Z) == (dot X Y) + (dot X Z).

Because the dot product of two normal vectors is the cosine of the angle between them, the dot product can be used conveniently to calculate the angle between two vectors:

 

FOR EXAMPLE

fn GetVectorsAngle v1 v2 =
(theAngle = acos(dot (normalize v1) (normalize v2))
)
GetVectorsAngle [10,0,0] [10,20,0]
63.435
Message 10 of 14
MedalHellWay
in reply to: jeffmorris

I don't understand.. you want that the position of one corner of the house is same of the pisition angle or that the corner wall of house is same of the angle??
Message 11 of 14
jeffmorris
in reply to: MedalHellWay

Here is the screenshot showing you how I want the script to rotate the house to match the angle of the gray rectangle. house01.PNG

Message 12 of 14
MedalHellWay
in reply to: jeffmorris

Try and adjust it!! 😄

 

rollout test "Test"
(
	button cb ""

	fn GetVectorsAngle v1 v2 = (theAngle = acos(dot (normalize v1) (normalize v2)) )
	on cb pressed do
	(
		
		for c = 1 to 2 do
		(
		ClickPos = pickPoint snap:#3D ()
		Point name:((uniquename "PointClickPos") as string) pos:ClickPos
		)
		gv = GetVectorsAngle $PointClickPos001.pos $PointClickPos002.pos
		rotate $ (angleaxis gv[0,0,1])
		delete $PointClickPos001
		delete $PointClickPos002
	)
	
)
createdialog test

 

Message 13 of 14
jeffmorris
in reply to: MedalHellWay

I found out that 3DS MAX 2016 has a new feature called "MAX Creation Graph". Is it possible to move the code to MCG?

Message 14 of 14
MedalHellWay
in reply to: jeffmorris

I think of yes, but I have not tried MCG...

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report