josue Corona Posted October 15, 2019 Share Posted October 15, 2019 Can someone please write me a simple script of a simple 3D square with a hole extrusion being subtracted from the middle , I sent screenshot of example. (Btw its a circle not a polygon , some reason looks like a polygon) My idea is to start learning from here . thank you thank you. Quote Link to comment
Pat Stanford Posted October 16, 2019 Share Posted October 16, 2019 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); Quote Link to comment
josue Corona Posted October 16, 2019 Author Share Posted October 16, 2019 (edited) What does it mean by handle to rectangle? Nevemind I think I got it. Edited October 16, 2019 by josue Corona Quote Link to comment
josue Corona Posted October 16, 2019 Author Share Posted October 16, 2019 (edited) I see some script have parameters, when are they used ? are parameter always created after making the script? I notice when making the script that option is grayed out. I will send a screen shot. Edited October 16, 2019 by josue Corona Quote Link to comment
Miguel Barrera Posted October 16, 2019 Share Posted October 16, 2019 Parameters are only for plugin OBJECTS, These you create yourself if you want the user to enter a value such as dimensions of rectangle, radius of circle, etc. which will be listed in the Object Info palette. Since the sample script is a COMMAND, it does not have any parameters defined. Quote Link to comment
josue Corona Posted October 16, 2019 Author Share Posted October 16, 2019 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. Quote Link to comment
josue Corona Posted October 16, 2019 Author Share Posted October 16, 2019 Thank Pat and Miguel Quote Link to comment
Pat Stanford Posted October 16, 2019 Share Posted October 16, 2019 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. 😉 Quote Link to comment
josue Corona Posted October 17, 2019 Author Share Posted October 17, 2019 I see, well I still need a lot to learn as far as scripting, so you might see me asking for help more that what I already do 😄 I have a vector questions why do some object only show up in 2d plan but when I change be they disappear ? I will attach a screen record Quote Link to comment
josue Corona Posted October 17, 2019 Author Share Posted October 17, 2019 Untitled.mov Quote Link to comment
josue Corona Posted October 17, 2019 Author Share Posted October 17, 2019 I made it a plug in, but now it disappear , oh also when I did that the circle is no longer subtracted from the square . Quote Link to comment
Pat Stanford Posted October 17, 2019 Share Posted October 17, 2019 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. Quote Link to comment
josue Corona Posted October 17, 2019 Author Share Posted October 17, 2019 its weird its basically the script you made for me, I did not change anything I just made it a plug in tool Quote Link to comment
josue Corona Posted October 17, 2019 Author Share Posted October 17, 2019 if I don't make it a plug in tool, it does work . Quote Link to comment
Miguel Barrera Posted October 18, 2019 Share Posted October 18, 2019 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. Quote Link to comment
josue Corona Posted October 18, 2019 Author Share Posted October 18, 2019 Creating Hybrid Object? The script made the object , do you mean like put a command that tells my object is a hybrid? Quote Link to comment
Miguel Barrera Posted October 18, 2019 Share Posted October 18, 2019 Meaning just like you create hybrid symbols. You include both a 2D and a 3D object(s) Quote Link to comment
Recommended Posts
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.