Jump to content
Developer Wiki and Function Reference Links ×

learning script


Recommended Posts

The faceting is due to your OpenGL Options being set to Low. Try setting it to high and it will be much smoother.

 

Procedure Test;

Var	H1,H2,H3,H4: Handle;  {create handles to be able to access objects}
	N1: Integer; {create a variable to accept the result fo the subtract}

Begin
	Rect(-10,-10,10,10);  {draw rectangle}
	H1:=LNewObj;          {Get handle to rectangle}
	H2:=HExtrude(H1,0,5);  {extrude rectancle}
	Oval(-3,-3,3,3);      {draw circle}
	H1:=LNewObj;          {get handle to circle. Not I am reusing handle variable}
	H3:=HExtrude(H1,0,10);  {ectrude circle}
	N1:=SubtractSolid(H2,H3,H4);  {subtract the extruded circle from the exturded rect}
	AlrtDialog(Concat('The Result of the SubtractSolid is:',N1)); {optional: report return value of subtraction}
End;

Run(Test);

 

Link to comment

Oh I understand, yea thats my next step to learn about perimeter. because for example in the Script that Pat gave me  i would like to make a parameter that will allow me to move the hole or down. 

One question when doing parameter there has to be extra script text that will combine the parameter with the script correct?

I don't know if that question even make sense sorry.

Link to comment

In my opinion, making a PIO is much more complicated than making a script. You could create a script that would display a dialog box, get a value, store that in a variable and then use that to modify how the script works.  Once you have it all working OK you could then relatively easily convert that to PIO and delete the dialog boxes and convert those variables into parameters.

 

There are just a lot of small details (from how you name variable/parameters to how you get into the code to edit it) that are more complicated in a PIO. If you add that level of frustration to just trying to learn to code, it will make it harder.

 

Plus, if you make a PIO, you can't just post a file for us to try and help. If you only post the code from the PIO, then either we have to create the PIO (including all of the parameters and defaults), or you have to send the PIO and we have to add it to our workspace to be able to help. I personally am much less likely to help with a PIO problem than with a script problem that I can work on quickly.

😉

 

 

Link to comment

PIOs are Hybrid Objects meaning they have a 2D (screen plane) component that shows in Top/Plan and a 3D component that shows in all other views.(actually since there are now multiple 2D views that is not entirely correct, but you get the idea.

 

If there are no Screen Plane objects, then the 3D portion will show in Top/Plan as a wireframe. If there are no 3D objects (layer plane or working plane) the 2D will show in all views.

 

You must have some kind of 2D object in your PIO script that is making it a hybrid. Probably the same error in the code that is not doing the subtraction properly. Make sure you have Handles to the correct objects before you do the subtraction.

Link to comment

I noticed that you placed the pio in Plan View which is a 3D view. That explains to some degree why the extrude fails and the pio disappears. Since the extrude fails for whatever reason, you are left with a rectangle and a circle which are 2D objects and you cannot view these objects in Plan View. It is only when you  switch to Top/Plan that they reappear.

 

the solution would be to create a Hybrid object. That is create the rectangle with the circular hole first in Top/Plan view and then duplicate and extrude the copy to create the 3D part.

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...