Notifications
Clear all

[Closed] Data Visualization = MaxScript + XML + CVS. Help!?

hi guys,
I’v been trying to import files like XML or CVS in MaxScript to make a visualization from the values in the file.

I’ve tried this:


– Data Visualization
–Mourad Bahrouch

–visualisation_rollOut_v1.ms

rollout rollOut_visualisation "visualisation" width:218 height:636
(

edittext name_1 "Land 1" pos:[21,40] width:160 height:25
spinner spn1 "" pos:[21,80] width:152 height:16

edittext name_2 "Land 2" pos:[21,120] width:160 height:25
spinner spn2 "" pos:[21,160] width:152 height:16

edittext name_3 "Land 3" pos:[21,200] width:160 height:25
spinner spn3 "" pos:[21,240] width:152 height:16

edittext name_4 "Land 4" pos:[21,280] width:160 height:25
spinner spn4 "" pos:[21,320] width:152 height:16

edittext name_5 "Land 5" pos:[21,360] width:160 height:25
spinner spn5 "" pos:[21,400] width:152 height:16

edittext name_6 "Land 6" pos:[21,440] width:160 height:25
spinner spn6 "" pos:[21,480] width:152 height:16

button btn1 "Create" pos:[24,520] width:80 height:21

fn drawLineBetweenTwoPoints pointA pointB =
	(
	  ss = SplineShape pos:pointA  -- sory for the smily.. it's : p o s : p o i n t A without space 
	  addNewSpline ss
	  addKnot ss 1 #corner #line PointA
	  addKnot ss 1 #corner #line PointB
	  updateShape ss
	  ss
	)

on btn1 pressed do
(


s1= sphere segs:30
s1.radius = spn1.value
s1.position = [random 100 500, random 10 500, 0] 
mytext1= text text:name_1.text render_renderable:true render_viewport_thickness: .5
mytext1.size= 10
mytext1.position=s1.position + [s1.radius,s1.radius,0]
	
s2= sphere segs:30
s2.radius = spn2.value
s2.position = [random 100 500, random 10 500, 0] 
mytext2= text text:name_2.text render_renderable:true render_viewport_thickness: .5
mytext2.size= 10
mytext2.position=s2.position + [s2.radius,s2.radius,0]


s3= sphere segs:30
s3.radius = spn3.value
s3.position = [random 100 500, random 10 500, 00] 
mytext3= text text:name_3.text render_renderable:true render_viewport_thickness: .5
mytext3.size= 10
mytext3.position=s3.position + [s3.radius,s3.radius,0]
	
s4= sphere segs:30
s4.radius = spn4.value
s4.position = [random 100 500, random 10 500, 0] 
mytext4= text text:name_4.text render_renderable:true render_viewport_thickness: .5
mytext4.size= 10
mytext4.position=s4.position + [s4.radius,s4.radius,0]	

s5= sphere segs:30
s5.radius = spn5.value
s5.position = [random 100 500, random 10 500, 00] 
mytext5= text text:name_5.text render_renderable:true render_viewport_thickness: .5
mytext5.size= 10
mytext5.position=s5.position + [s5.radius,s5.radius,0]

s6= sphere segs:30
s6.radius = spn6.value
s6.position = [random 100 500, random 10 500, 0] 
mytext6= text text:name_6.text render_renderable:true render_viewport_thickness: 0.1
mytext6.size= 10
mytext6.position=s6.position + [s6.radius,s6.radius,0]

	
newSpline1 = drawLineBetweenTwoPoints s1.position s2.position
newSpline1.render_renderable = true
newSpline1.render_thickness = random 1 2

newSpline2 = drawLineBetweenTwoPoints s2.position s3.position
newSpline2.render_renderable = true
newSpline2.render_thickness = random 1 2

newSpline3 = drawLineBetweenTwoPoints s3.position s4.position
newSpline3.render_renderable = true
newSpline3.render_thickness = random .1 2

newSpline4 = drawLineBetweenTwoPoints s4.position s5.position
newSpline4.render_renderable = true
newSpline4.render_thickness = random 1 2
newSpline5 = drawLineBetweenTwoPoints s5.position s6.position
newSpline5.render_renderable = true
newSpline5.render_thickness = random 1 2

newSpline6 = drawLineBetweenTwoPoints s6.position s1.position
newSpline6.render_renderable = true
newSpline6.render_thickness = random 1 2

	
		
actionMan.executeAction 0 "311"
)

)
createDialog rollOut_visualisation

It works as I wanted. But I want to import the information from an extern file: XML and/or CVS. So not manually typing the name and the value.

Any ideas?

Thank you!

3 Replies

help please?

Take a look at the .NET XmlDocument class, I think that would be the easiest way to read small Xml files from maxscript. If you’re going to be parsing more data, or more complex structures, the XmlSerializer might help you out.

 PEN

My XML tutorial using Dot Net might help you.

http://penproductions.ca/tutorials/dotNet/dotNet.htm