Jump to content
Developer Wiki and Function Reference Links ×

Would anyone be up for an object-building "challenge"?


SamIWas

Recommended Posts

A lot of the PIOs I make in Vectorscript are for building objects I use extensively, but need to change depending on inputted variables.  I have my way of coding the construction of those objects, but I'm wondering if whatI'm doing is best practice, or if there are ways I haven't thought of.   I have learned so much from this forum, I thought it might be fun to see how others might code the building of a mildly complex object.   The attached picture is of a lighting stand that is built entirely in Vectorscript using a series of sweeps, extrudes, Solid Additions, Solid Subtractions, etc.   It works exactly as planned.  But, is it done "right"?   

 

Would anyone be interested in a quick little "challenge" to have a provided object that needs to be built in Vectorscript using a few different methods?  Nothing nearly as complicated as the attached stand, but using a lot of the same ideas.  Something that others could look at and learn from or maybe find out how what they are currently doing isn't the most efficient way?

 

If so, I'll whip up a little example object and post it here.

 

 

 

image.png.a98eb49dda672d7f6f17fcc5d7d7d77e.png

  • Like 4
Link to comment
1 hour ago, Neves+Creative Inc. said:

I have never used vectorscript but would be interested in taking a look to see how this is done. 

 

So, this is an object full of random parts that I'm thinking about using.  I'll spit out the code sometime tonight and provide some more info.

image.png.9344f5ce67532b20af6ec5bf9a2b306b.png

  • Like 1
Link to comment
On 10/14/2023 at 11:24 AM, SamIWas said:

Would anyone be interested in a quick little "challenge" to have a provided object that needs to be built in Vectorscript using a few different methods?

 

Interested and following but no bandwidth to participate.  My code-time is all soaked by the never-ending wish-list for my current tool line-up (which, BTW, other than the bits that embed Symbols, all are written in VectorScript).  The latest feature addition has turned into consuming several days spanning multiple weeks.

 

FWIW, @SamIWas, if the quality of your other tools is along the lines of what you posted, it might be worth considering selling licenses.  Ya might get some ROI...

 

  • Like 1
Link to comment

We're all interested.  Like @C. Andrew Dunning I don't have the band width because of my own projects, and that may be the rule here, which is too bad.  We would all love to see what others have figured out, and even share some cool tricks.  You may get comments on the code you post, and maybe we can have a good discussion around that code that includes are own code snippets.  I hope I'm wrong, but a serious go at the picture above would be daunting, interesting, but daunting.  Hopefully, @michaelk, who is an excellent VS drawer, or @PatStanford who loves the puzzle will jump in, but again, bandwidth will handicap a serious VS attempt to make a PIO out of that drawing.  Here's hoping.

  • Like 1
Link to comment
55 minutes ago, C. Andrew Dunning said:

 

Interested and following but no bandwidth to participate.  My code-time is all soaked by the never-ending wish-list for my current tool line-up (which, BTW, other than the bits that embed Symbols, all are written in VectorScript).  The latest feature addition has turned into consuming several days spanning multiple weeks.

 

FWIW, @SamIWas, if the quality of your other tools is along the lines of what you posted, it might be worth considering selling licenses.  Ya might get some ROI...

 

I do indeed intend on selling some of the stuff I have made.  I'm trying to get them "beta tested" right now, and then I need to figure out how to build a selling platform, in which case I might contact you and some others about how you set up your sales portals.   I don't think I intend to go so far as to lock the plugins to a serial number (even thought that would probably lose a few sales), because I have no idea how that would even work and it seems daunting. 

Link to comment
42 minutes ago, Sam Jones said:

Hopefully, @michaelk,  … or @PatStanford who loves the puzzle will jump in, but again, bandwidth will handicap a serious VS attempt to make a PIO out of that drawing.  Here's hoping.

 

I'm replying from a tech table in a theater and I have 5 tools that I desperately want to use for my own work that have been 95% done for months.  So my bandwidth is also limited. 🙂 

 

But I love the idea.  One of the great things about this forum is seeing how other people build VW tools.

Link to comment
19 minutes ago, michaelk said:

 

I'm replying from a tech table in a theater and I have 5 tools that I desperately want to use for my own work that have been 95% done for months.  So my bandwidth is also limited. 🙂 

 

But I love the idea.  One of the great things about this forum is seeing how other people build VW tools.

With the film industry shut down right now, I am full of bandwidth!

Link to comment

And my code...my code is fairly simple and not meant to be a complex, event-enabled object.  This was more about just the code to draw the parts.  Took about 75 minutes from start to finish to write and test the whole thing.

 

I'd really love to see how others code this kind of thing to see if what I've done is in line with more established programmers.  Particularly in the way that sweeps and extrudes are created and then constantly rotated into the right orientation.

 

{IllumiViz VW Challenge Plug-In
Version 1.0
Last Updated 10/16/23 6:15pm EST}

PROCEDURE VWChallenge;

VAR
	objname : STRING;
	result, markertest : BOOLEAN;
	oh,rh,wh : HANDLE;

	count, subtract, addition : INTEGER;
	armang,nub : REAL;
	ctan, cgreen, crust, cred, cblue, cgrey : LONGINT;
	s1, s2, s3, a1, a2, a3, part1, part2, armg : HANDLE;



BEGIN


	{--------------------SYMBOL INFO-----------------------}

	PushAttrs;


	{--------------------MENU INFO-----------------------}

	nub:=PNUBSIZE;
	IF nub<0.5" THEN BEGIN nub:=0.5"; SetRField(oh,objname,'NubSize',num2strf(nub)); END;
	IF nub>8" THEN BEGIN nub:=8"; SetRField(oh,objname,'NubSize',num2strf(nub)); END;

	armang:=PARMANGLE;
	IF armang<0 THEN BEGIN armang:=0; SetRField(oh,objname,'ArmAngle',num2str(2,armang)); END;
	IF armang>75 THEN BEGIN armang:=75; SetRField(oh,objname,'ArmAngle',num2str(2,armang)); END;


	{-------------COLOR AND TEXT DEFINITIONS-------------}
	
	FPatByClass;
	FillColorByClass;
	OpacityByClass;
	LSByClass;
	LWByClass;
	PenColorByClass;
	markertest:=SetDefaultBeginningMarker(1,15,0.25",0.125",1,1,FALSE);
	markertest:=SetDefaultEndMarker(1,15,0.25",0.125",1,1,FALSE);
	Closepoly;
	
	RGBtoColorIndex(53500,43500,34000,ctan);
	RGBtoColorIndex(16500,33000,16500,cgreen);
	RGBtoColorIndex(30500,16500,16500,crust);
	RGBtoColorIndex(65535,5000,5000,cred);
	RGBtoColorIndex(5000,5000,65535,cblue);
	RGBtoColorIndex(20000,20000,20000,cgrey);


	{--------------------CREATE 3D-----------------------}
	
	NameClass('None');
	
	FillFore(ctan);FillBack(ctan);
	
		BeginSweep(0,360,10,0);		{main circle}
			Locus(0",0");
			Poly(0",0", 9",0", 9",5", 7",5", 7",2", 0",2", 0",0");
			EndSweep;
		s1:=LNewObj;
		Set3DRot(s1,90,0,0, 0",0",0");
		
		
		BeginSweep(0,360,22.5,0);	{indented circle}
			Locus(0",0");
			Poly(0",0", 1",0", 1",0.75", 0",0.75", 0",0");
			EndSweep;
		s2:=LNewObj;
		Move3DObj(s2,0",-9",2");

		subtract:=SubtractSolid(s1,s2,s3); DelObject(s1); DelObject(s2);

		BeginXtrd(-0.75",0.75");		{arch}
			Poly(-6.75",0", -5.25",0", -5.25",10.5", 5.25",10.5", 5.25",0", 6.75",0", 6.75",12", -6.75",12", -6.75",0");
			EndXtrd;
		a1:=LNewObj;
		Set3DRot(a1,90,0,0, 0",0",0"); Move3DObj(a1,0",0",2");

		BeginXtrd(-0.75",0.75");		{arch}
			Poly(-6.75",0", -5.25",0", -5.25",10.5", 5.25",10.5", 5.25",0", 6.75",0", 6.75",12", -6.75",12", -6.75",0");
			EndXtrd;
		a2:=LNewObj;
		Set3DRot(a2,90,0,90, 0",0",0"); Move3DObj(a2,0",0",2");

		addition:=AddSolid(a1,a2,a3); DelObject(a1); DelObject(a2);

	FillFore(cgreen);FillBack(cgreen);
		
		part1:=NIL; 
		BeginXtrd(-0.5",0.5");		{side triangles}
			Poly(0",0", 1.5",0", 0",3.5", 0",0");
			EndXtrd;
		part1:=LNewObj;
		Set3DRot(part1,90,0,0, 0",0",0");	Move3DObj(part1,8.9",0",0");	Set3DRot(part1,0,0,15, 0",0",0");

		FOR count:=1 to 11 DO BEGIN
			part2:=NIL; part2:=HDuplicate(part1,0",0"); Set3DRot(part2,0,0,count*30, 0",0",0");
			END;

	FillFore(crust);FillBack(crust);
	
		BeginSweep(0,360,22.5,0);	{post collar}
			Locus(0",0");
			Rect(0.3",0", 0.55",2");
			EndSweep;
		Set3DRot(LNewObj,90,0,0, 0",0",0"); Move3DObj(LNewObj,0",0",2");
		
		BeginSweep(0,360,22.5,0);	{post}
			Locus(0",0");
			Poly(0",0", 0.25",0", 0.25",14", 0",14", 0",0");
			EndSweep;
		Set3DRot(LNewObj,90,0,0, 0",0",0");	Move3DObj(LNewObj,0",0",2");	
		
		BeginSweep(0,360,10,0);	{wheel ring}
			Locus(0",0");
			Oval(1.625",-0.375", 2.375",0.375");
			EndSweep;
		Set3DRot(LNewObj,90,0,0, 0",0",0");	Move3DObj(LNewObj,0",0",16");

		BeginXtrd(-0.25",0.25");	{wheel ribs}
			Poly(0.783",1.857", 1.217",1.607", 0.289",0.000", 1.217",-1.607", 0.783",-1.857", -0.144",-0.250", -2.000",-0.250", -2.000",0.250", -0.144",0.250");
			EndXtrd;	
		Move3DObj(LNewObj,0",0",16");

	FillFore(cgrey);FillBack(cgrey);

		part1:=NIL; 
		BeginXtrd(-1",1");
			RegularPolygon(0",0",12.7,6,1);	SetPolyClosed(LNewObj,TRUE);
			EndXtrd;
		part1:=LNewObj;
		Set3DRot(part1,90,0,0, 0",0",0");	Move3DObj(part1,6",0",13.25");

		part2:=NIL; part2:=HDuplicate(part1,0",0"); Set3DRot(part2,0,0,90, 0",0",0");
		part2:=NIL; part2:=HDuplicate(part1,0",0"); Set3DRot(part2,0,0,180, 0",0",0");
		part2:=NIL; part2:=HDuplicate(part1,0",0"); Set3DRot(part2,0,0,270, 0",0",0");
			
		BeginGroupN(armg);

			BeginXtrd(0",6");	{arm}
				Rect(-0.5",-0.5", 0.5",0.5");
				EndXtrd;
			SetFillFore(LNewObj,cblue);SetFillBack(LNewObj,cblue);

			BeginSweep(0,360,10,0);	{nubbin}
				Locus(0",0");
				IF PNUBSHAPE='Pointed' THEN Poly(0",0", nub,0", nub,0.5", 0",2", 0",0");
				IF PNUBSHAPE='Rounded' THEN BEGIN
					BeginPoly;
						MoveTo(0.000",0.000");
						LineTo(nub,0.000");
						Add2dVertex(nub,nub+0.500",3,nub);
						LineTo(0.000",nub+0.500");
						LineTo(0.000",0.000");
						EndPoly;
					END; {rounded}
				IF PNUBSHAPE='Stepped' THEN Poly(0",0", nub,0", nub,0.5", nub/2,0.5", nub/2,1", 0",1", 0",0");	
				EndSweep;
			SetFillFore(LNewObj,cred);SetFillBack(LNewObj,cred);
			Set3DRot(LNewObj,90,0,0, 0",0",0");	Move3DObj(LNewObj,0",0",6");
				
			EndGroup; {armg}

		Set3DRot(armg,0,90-armang,0, 0",0",0");	Move3DObj(LNewObj,6.25",0",9");

		part1:=NIL; part1:=armg;
		part2:=NIL; part2:=HDuplicate(part1,0",0"); Set3DRot(part2,0,0,90, 0",0",0");
		part2:=NIL; part2:=HDuplicate(part1,0",0"); Set3DRot(part2,0,0,180, 0",0",0");
		part2:=NIL; part2:=HDuplicate(part1,0",0"); Set3DRot(part2,0,0,270, 0",0",0");	
	
	PopAttrs;

	END;
	
Run(VWChallenge);

 

Link to comment
1 hour ago, VIRTUALENVIRONS said:

I have no idea how to use Vectorscript or Marionette.  I have a question.

 

Question. The image posted above,  What is the advantage of making it in Vectorscript/Marionette instead of just modelling it?

As Michael said, it's about the parameters.  In my provided example, I can change the shape of the red end pieces and the angle of the four arms.  I have others that allow a huge amount of customization to some very large and complex objects like boom lifts and scissor lifts.

Link to comment
1 hour ago, VIRTUALENVIRONS said:

Question. The image posted above,  What is the advantage of making it in Vectorscript/Marionette instead of just modelling it?

 

Another way to answer your question:  Place a Spotlight Stage Lift object.  Now, make changes like entering different heights - including known undoables, like 60'.  The object will reconfigure itself.  Now, imagine creating the object from-scratch (extrudes, sweeps, moves, textures, etc.) and making changes manually - to either 2D or 3D...or, both.  The Stage Lift object is 100% VectorScript generated (including texture generation) and changes are sub-second as needs change.

 

That help???

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...