Jump to content

MaxStudio

Member
  • Posts

    319
  • Joined

  • Last visited

Posts posted by MaxStudio

  1. I'm trying to write a script that will allow me select an object by line weight. Our office works in mils so the the numbers will be whole numbers.

    I've gotten the following to work

    BEGIN

    SelectObj(LW=4);

    END;

    but if I change the 4 to a variable such as 'n' be it a real, integer or longint

    the script stops working

    VAR

    n : (Real, integer, or longint);

    BEGIN

    n:=4;

    SelectObj(LW=n);

    END;

    Does anyone know why this is happening? Is it not possible to use a variable in this situation?

    Thanks in advance,

    Derek

  2. If I only wrote code a little more frequently I might even be able to post answers myself.

    I usually ask the question and if I make some progress on my own I post my progress and solution anyway. I figure it may help someone else out some day!

    Happy it all worked out for you!

  3. ok, i created a simple example that seems to work. Unfortunately, I'm a little confused by the starting location for the x and y parameters. The x seems to be the bottom left corner while the y seems to be centered on the object causing me to subtract or add half the height. It is not a big problem, but does anyone have any idea why this is?:

    **If anyone can see any errors in my code or ways to improve my code your comments are always appreciated**

    PROCEDURE plugin;
    VAR
    
    x, y, w, h, LineLength, BoxWidth, Offset : REAL;
    
    result							: BOOLEAN;
    objname							: STRING;
    oh,rh,wh						: HANDLE;
    
    BEGIN
    { retrieve custom object information }
    result:= GetCustomObjectInfo(objname,oh,rh,wh);
    
    { if object information was successfully retrieved }
    IF result THEN BEGIN
    	{ retrieve parameters }
    
    	LineLength	:= PLINELENGTH;
    	BoxWidth		:= PBOXWIDTH;
    	Offset		:= POFFSET;
    
    w:=LineLength;
    h:=BoxWidth;
    
    
    PenSize(4);
    Rect(x,y-(h/2),x+w,y+(h/2));
    
    PenSize(2);
    Rect(x+Offset,y-(h/2)+Offset,x+w-Offset,y+(h/2)-Offset);
    
    END;
    END;
    Run(plugin);

  4. Hello,

    I've created a Plugin Object that creates a rectangle with another rectangle offset on the inside.

    The Object Info Pallette has the following variables:

    Width

    Height

    Offset of Inner Rectangle

    At the moment I can only edit the dimensions of the rectangles by changing the dimensions of the variables via the Object Info Pallette.

    I would like to be able to select the Plugin Object, click the handle, and drag the handle to modify the rectangles dimensions.

    Basically, I just want the ability to manipulate the plugin object like a normal rectangle. Is this possible?

    Thanks in advance.

  5. I'm looking for a simple way to run a script that simply returns a message with the current file's name and path.

    I'm guessing its a simple script, there might even be a simple way to view it in vectorworks already?

    I'm looking into GetFileInfo and using Message to display my results, but I'm not having any luck. Any ideas?

    Thanks

    Derek

  6. Is the name used in the script the same name i give the plugin in the VectorScript Plug-in Editor?

    If so, how do i differentiate between 2 different objects create with the same plugin tool.

    Example: I create one window in plan using the plugin. Its with will be 24". I then create a window in elevation that is linked to the window in plan. Its with is 24". I now want to create a new window in plan that will be 36". Will there be issues with the width if I create this new 36" window?

    Sorry if I'm confusing you folks. I am always trying to work these things out on my own and appreciate the help.

    Thanks

    Derek

  7. ok so here you are saying I need to have a record created. I store the width in one of the record fields. The objects reference the record to obtain the width. when I change the width of objectA it changes the width of the field in the record therefore changing the width of objectB?

    Next question, how do i create the record? and how do I get both objects to reference the same record?

  8. DWorks,

    but how would I go about referencing an outside plugin object in my script? Is there a way to give the plugin object a name once it is created?

    I have a plugin object that creates a window in plan. I also have a plugin object that creates a window in elevation. I want to be able to change the width of the window in plan and have it also change the width of the window in elevation. and vice versa. This means I need to be able to create each object seperately and then i need to be able to link the two (using a parameter or a name) is it possible or is there a better way to do this?

  9. Anyone know a way to create two different plugin objects that utilize a common parameter?

    I want to be able to create an object (objectA) and another object (objectB). I need a way to link objectA and objectB together. Once they are linked I would like them to be able to utilize a common parameter, such as, the object width.

    This way if I change the width of objectA the width of objectB changes as well.

    Any ideas?

    Thanks in Advance

    Derek

  10. Ok i've made a little more progress:

    IF checkbox {boolean} THEN BEGIN

    SetParameterVisibility(inPlugin, 'parameter', TRUE);

    END;

    Is the inplugin handle the object handle created at the beginning of the script, see below

    result : BOOLEAN;

    objname : STRING;

    oh,rh,wh : HANDLE;

    BEGIN

    { retrieve custom object information }

    result:= GetCustomObjectInfo(objname,oh,rh,wh);

    in this case would oh be the plugin handle?

  11. This is what i found:

    PROCEDURE SetParameterVisibility(inPlugin :HANDLE; inParameterName :STRING; inSetVisible :BOOLEAN);

    I would assume something like this would work:

    IF checkbox {boolean} THEN BEGIN

    SetParameterVisibility(inPlugin, PParmeter, TRUE);

    END;

    What is the inPlugin handle? I know how to give an object created, such as a rectangle, a handle, but how do i give the whole plugin object a handle?

  12. Everytime I import a DWG file the arrow heads on the imported file are huge. I have to go and select each individual arrowhead and change it manually. Is there a way that I change them all at once without having to do it one by one?

    The arrowheads are huge in paperspace but look normal in model space.

  13. Is it possible to recall printer settings with a script?

    Sometimes I print full size and at other times I print half size. I print full size to a plotter and I print half size to a printer. Is it possible to store and recall printer settings using a script? It would be nice to just click a button that says "print half size" or "print full size".

    I know I can use PrintUsingPrintDialog, but I don't want to have to change the settings each time.

    There is also PrintWithoutUsingPrintDialog, but then I'm guessing it only uses the current print settings.

    Anyone had any experience with this?

    Thanks

    - Derek

×
×
  • Create New...