Jump to content

virk

Member
  • Posts

    15
  • Joined

  • Last visited

Posts posted by virk

  1. Sorry, yes my code is successful 🙂

    And you may be right; if any input values are not "correct", output will also be corrupt somehow. But currently the code outputs exactly what I want it to be.

    Further: I think, if you copied the code manually: create two arcs, ClipSurface them, delete the arcs and sweep the clipped surface, you will lose the ability to later change the diameter somehow, because the original arcs are deleted. But because of the plugin-character, - the elbow will be calculated newly when required-, you can make/configure any elbow with just the parameters in the object info palette. For me as a total Vectorscript-newbie this is quite interesting 🙂

  2. This is my elbow code:

     

            BeginSweep(0,90,seg,0);
                Locus(radius,0);
               ArcByCenter(0,0,diameter/2,0,360);
               arc1:=LNewObj;
               ArcByCenter(0,0,diameter/2-thick,0,360);
               arc2:=LNewObj;
               sweepHd:=ClipSurfaceN(arc1,arc2);
               DelObject(arc1);
               DelObject(arc2);
            EndSweep;
     

  3. Yes, concentric reducer now shows up correctly 🙂

     

    One further question: I tried to "make" an elbow. Main code is as follows:

    	BEGIN	
              BeginSweep(0,90,seg,0);
                 Locus(radius,0);
                 ArcByCenter(0,0,diameter/2,0,360);
              EndSweep;
              sweepHd:=CreateShell(sweepHd,thick);
              Locus3D(0,0,0);
              Locus3D(radius,0,-radius);		
    	END;

    The "CreateShell" line is wrong. Does anybody know, how to correctly apply a "wall thickness" to this sweeped elbow? With Vectorworks itself I can do it by just selecting the sweeped circle, apply "Shell Solid Tool", Shift-click both edge surfaces of this sweeped circle and click the green "hook" for completing the operation.

     

     

  4. Thank you all for your contributions; especially Jesse: Should you ever come to Aachen/Germany, be sure you get a free beer from me: Yesterday I investigated your post. Finally I made it run (changed "LineLength" by "lineLength" once and changed the 90° by -90°).

    I adjusted the code in a way that the cone now has got two different wall thicknesses for the two different diameters. For this I created a closed polygon which is swept afterwards:

    The code is here (only small adjustments compared to yours, and "CreateReducerH" not changed):

    PROCEDURE ConcentricReducer; {All methods in VS are either Functions or Procedures.  Functions return a value, procedures perform a set of operations, though they can also return a value if you need to.  To do so, specify a variable in the constructor with a VAR flag in front of it}
    {*    Creates a 3D Solid object representing a Concentric Reducer pipe fitting
        Developed by: Jesse Cogswell
        VW Version: 2019
        Date: 5/1/2021
        Revisions:
    *}
    CONST {This is the constant declaration block.  All constants in VS must be declared and initialized in one of these blocks.  You do not need to specify types here, VS will determine the type based on the entered value.  This block is not necessary if you have no constants, it's provided here by way of example}
        DUMMY = 0;
    VAR {This is the variable declaration block.  All variables in VS must be declared in one of these blocks before it can be used.  This particular one is the global variable block.  Here, we'll declare the parameter variables}
        lineLength,diameter1,diameter2,thick1,thick2:REAL;
        {reducerHD: HANDLE;}
        
    {Between this point and the main driver block, you can specify any number of procedures and functions as necessary.  VS compiles from top to bottom, so if you call a procedure, make sure the definition appears above the call}
        
    PROCEDURE CreateReducer(length,dia1,dia2,thick1,thick2:REAL); {Here is the procedure that actually creates the 3D solid.  It takes in the length and two diameters and creates the object}
    {Creates 3D Solid based on given variables}
        VAR {Just as above, this procedure has its own variable declaration block.  The variables declared can only be used within this procedure definition}
        
            Origin,A,B,C,D:POINT;
            sweepHd:HANDLE;
            
        BEGIN
            {I usually specify an Origin point but don't initialize it, this ensures that it will read as (0,0)}
            {Point types are a special Structure within VS which contains an X and a Y value.  This information can be accessed by calling <point name>.x or <point name>.y}
            {Other special Structures include POINT3D, VECTOR, and RGBCOLOR types}
            {You can define your own Structures in the TYPE declaration block, though it's a bit more of an advanced usage. Information can be found in the Language Guide in the "Structures" chapter} 
            A.x:=Origin.x+(dia1*0.5)-thick1;
            A.y:=Origin.y;
            B.x:=Origin.x+(dia1*0.5);
            B.y:=Origin.y;
            C.x:=Origin.x+(dia2*0.5);
            C.y:=Origin.y+length;
            D.x:=Origin.x+(dia2*0.5)-thick2;
            D.y:=Origin.y+length;
            
            BeginSweep(0,360,15,0);
                 Locus(0,0);
                {Locus(Origin.x,Origin.y);}
                {Poly(Origin.x,Origin.y,A.x,A.y,B.x,B.y,Origin.x,B.y,Origin.x,Origin.y);}
                {Poly(dia1/2-thick1,0,dia1/2,0,dia2/2,length,dia2/2-thick2,length,dia1/2-thick1,0);}
                Poly(A.x,A.y,B.x,B.y,C.x,C.y,D.x,D.y,A.x,A.y);
            EndSweep;
            sweepHd:=LNewObj;
            
            HRotate(sweepHd,Origin.x,Origin.y,-90);
            {Because of the nature of Sweep command, the outlining shape is created 90 degrees off from the created line and then rotated in place}
        END;
        
    FUNCTION CreateReducerH(length,dia1,dia2,thick1,thick2:REAL) : HANDLE; {Here is the same code as above but as a function to return a handle to the resulting object.  This is useful if you wanted to use another procedure to change the object later, such as setting color}
    {Creates 3D Solid based on given variables and returns a handle to the resulting 3D Solid}
        VAR
        
            Origin,A,B:POINT;
            sweepHd:HANDLE;
            
        BEGIN
            A.x:=Origin.x+(dia1*0.5);
            A.y:=Origin.y;
            B.x:=Origin.x+(dia2*0.5);
            B.y:=Origin.y-length;
            
            BeginSweep(0,360,15,0);
                Poly(Origin.x,Origin.y,A.x,A.y,B.x,B.y,Origin.x,B.y,Origin.x,Origin.y);
            EndSweep;
            sweepHd:=LNewObj;
            
            HRotate(sweepHd,Origin.x,Origin.y,90);
            CreateReducerH:=sweepHd; {This is how you specify the returned value, it's <Function Name>:= <variable>}
        END;
    {MAIN DRIVER BLOCK}
    BEGIN
        {At the beginning of the Main Driver Block, I will always transfer the OIP parameters, accessed using the syntax "P<parameter name>" into global variables.  This is a personal preference, and you're welcome to just use the P<parameter name> call everytime you need the variable}
        lineLength:=PLineLength;
        diameter1 :=Pdiameter1;
        thick1    :=Pthick1;
        diameter2 :=Pdiameter2;
        thick2    :=Pthick2;
        
        CreateReducer(lineLength,diameter1,diameter2,thick1,thick2);
        {Best practice is to think in a modular fashion, with most operations being outside of the main driver}
        
        {Below is an example of the using the function instead of the procedure to create the object.  Note that the handle would need to be declared in the global variable declaration block before this code could be used}
        {reducerHd:=CreateReducerH(lineLength,diameter1,diameter2);}
    END;
    Run(ConcentricReducer); {Final run statement to execute the script}

    I could not make your "Concentric reducer" run; the code here did not display anything 🙂

     

    I have some more questions:

    1) Are all definitions (f.e. "Edit definition....") stored in the vso-file?

    2) Should I place 10,100,1000 concentric reducers looking all the same (diameters, length, wall thicknesses, color, etc.), what is the most efficient way to do? Should I cut, copy, paste the concentric reducer made by the VS-code or should I make a symbol of it and cut, copy, paste the symbol?

  5. Hello! We are currently working with VW2021 basic english.

    I would like to investigate the possibilities of the plugin-objects, which can be done via Vector-script as far as I know.

    As a first object I would like to have a multiple extrude which is the result of two concentric circles of different diameters and a "length". The result should be a rotationally symmetric cone with one diameter at one end end the other diameter at the distance "length" at the other end. (In the piping industry this is called a concentric reducer).

    Concerning plugin-objects I am a total newbie.

     

    1) Can someone guide me how to start with this?

    2) Does somebody know a link where I can download some simple files (vectorscript-objects) which enable me to begin to understand?

    3) Helpful also would be a link to a movie where first basic steps are explained.

     

    Thanks a lot for any help.

  6. Hello! We are currently working with VW2021 basic english.

    I would like to investigate the possibilities of the plugin-objects. As a first object I would like to have a multiple extrude which is the result of two concentric circles of different diameters and a "length". The result should be a rotationally symmetric cone with one diameter at one end end the other diameter at the distance "length" at the other end. (In the piping industry this is called a concentric reducer).

    Concerning plugin-objects I am a total newbie. Can someone guide me how to start with this?

  7. We work with then english Vectorworks 2021. We design a model consisting of a.o. many symbols which again consist of sweeps (f.e. 2D line sweep around a "center" point) and extrusions. We export this model as a step-file. When our client  imports the step-file into his CAD-software, the extrusions are visible "correctly" as solids but the sweeps are only visible with shiny surfaces, where you can look through, which is undesirable.

    What can we do to solve this problem so that sweeps are also displayed opaque as solids?

  8. I am using Vectorworks 2018 (english version) with Macbook Pro 2017 with High Sierra. I could update to Mojave, when I get confirmation that Vectorworks 2018 works without problems with Mojave. Can you/somebody confirm that combination of VW2018 with Mojave 10.14.3 works comparable stable to VW2018 with High Sierra 10.13.6?

  9. Hello power users!

     

    I use "Fundamentals" of VW2018 in 2D-mode here. I like to do the following:

     

    1) Create a symbol which consists of several symbols under which there number appear: 6111, 6121, 6131, ... 61X1.

    2) Place this symbol several times on the drawing.

    3) Only need to change "X" for one symbol once so that at f.e. 7th symbol the internal symbols are tagged: 6171, 6172, 6173, ....

    4) This should also remain visible, when symbols are not only copied but also if they are copied and then (horizontally) mirrored.

     

    Did I explain my wish clearly enough. Any hints welcome!

  10. Hey thank you all for your advice:

    "but" i do not want to work with command HideClass() but with the command Hide(..anything..). If i use this command there seems to be no redraw of the whole drawing.

    The "keydown"-command does not seem to work the way i want it to work. Can't i determine within a script, whether this script has been started with just double click or (option/shift...)double-click.

    Kind regards

  11. Is it possible to create a script like

    ...

    case option of

    TRUE; Show(C='...

    FALSE; Hide(...

    ...

    I would like to have one "Script", which i start with the "option" key pressed or not. The result should make visible or unvisible certain objects, classes, etc.

    It seems that the pressing of the option key is not recognized as i would like it.

    Kind regards

×
×
  • Create New...