Jump to content

JBenghiat

Member
  • Posts

    2,024
  • Joined

  • Last visited

Posts posted by JBenghiat

  1. To create a VP, call CreateVP() and use object variables to set as section:

    https://developer.vectorworks.net/index.php?title=VS:CreateVP

    https://developer.vectorworks.net/index.php?title=VS:Function_Reference_Appendix_G#Viewports

     

    However, creating a section VP via VS doesn't seem possible

     

    // Viewport type selectors
    // --------------
    const short ovViewportProjectionType		= 1000;    	// short	read/write - the viewport projection type. - Public for VS
    const short ovViewportRenderType			= 1001;		// short	read/write - the viewport render type. - Public for VS
    const short ovViewportPerspectiveDistance	= 1002;		// real		read/write - the viewport perspective distance (used with custom perspective). - Public for VS
    const short ovViewportScale					= 1003;		// real		read/write - the viewport scale. - Public for VS
    const short ovViewportDirty					= 1004;		// Boolean  read/write - the viewport out-of-date (dirty) state. - Public for VS
    const short ovViewportProject2D				= 1005;		// Boolean  read/write - the viewport project 2D state. - Public for VS
    const short ovViewportRenderBackground		= 1006;		// Sint32		read/write - the viewport render background. - Public for VS
    const short ovViewportViewType				= 1007;		// short	read/write - the viewport view type. - Public for VS
    const short ovViewportLineWeightScale		= 1008;		// double	read/write - the viewport line weight scale. - Public for VS
    const short ovViewportArrowheadScale		= 1009;		// double	read/write - the viewport arrowhead scale. - Public for VS
    const short ovViewportDashedLineScale		= 1010;		// double	read/write - the viewport dashed line length/spacing scale. - Public for VS
    const short ovViewportHatchLineScale		= 1011;		// double	read/write - the viewport hatch line spacing scale. - Public for VS
    const short ovViewportDesignTextScale		= 1012;		// double	read/write - the viewport design layer referenced text size scale. - Public for VS
    const short ovViewportSlashThicknessScale	= 1013;		// double	read/write - the viewport slash thcikness scale. - Public for VS
    const short ovViewportAmbientIsOn			= 1014;		// Boolean  read/write - the viewport ambient light is ON or OFF. - Public for VS
    const short ovViewportAmbientBrightness		= 1015;		// double	read/write - the viewport ambient light brightness. - Public for VS
    const short ovViewportAmbientColor			= 1016;		// WorldPt3 read/write - the viewport ambient light color. - Public for VS
    const short ovSetDesignLayerVisibilityInAllViewports	= 1017;	// short, -1 = invisible, 0 = normal, 2 = grayed - Public for VS
    const short ovSetClassVisibilityInAllViewports			= 1018;	// short, -1 = invisible, 0 = normal, 2 = grayed - Public for VS
    const short ovViewportHDRIBackground		= 1019;		// Sint32		read only  - the background for environment lighting - Public for VS
    const short ovSectionVP2DAttributeClass		= 1020;		// Sint32		read only - the RefNumber of the class responsible for attributes of overall cross-section or just the x-section of structural elements. - Public for VS
    const short ovSectionVP2DOtherAttribClass	= 1021;		// Sint32		read only - the RefNumber of the class responsible for attributes of cross-section generated from non-structural elements - Public for VS
    const short ovSectionVP3DFillStyleClass		= 1022;		// Sint32     read only - the RefNumber of the class reposnsible for fill style of the objects beyond section plane - Public for VS
    const short ovSectionVP3DLineStyleClass		= 1023;		// Sint32     read only - the RefNumber of the class responsible for line style of the objects beyond section plane - Public for VS
    const short ovViewportXPosition				= 1024;		// double   read only - the X coordinate of the viewport on the sheet layer - Public for VS
    const short ovViewportYPosition				= 1025;		// double   read only - the Y coordinate of the viewport on the sheet layer - Public for VS
    const short ovViewportAngleWithXAxis		= 1026;		// double	read only - the angle that the viewport subtends with the X axis on the sheet layer in degrees - Public for VS
    const short ovViewportShowWallComponents_OBSOLETE	= 1027;
    const short ovViewportGrayTransparent		= 1028;		// Boolean  read/write - the viewport renders gray layers transparent - Public for VS
    const short ovViewportFlipText				= 1029;		// Boolean  read/write - the viewport/dlvp adjusts for flipped text - Public for VS
    const short ovViewportBlackAndWhite			= 1030;		// Boolean  read/write - the viewport/dlvp draws in black and white only - Public for VS
    const short ovViewportUseDocumentClassVis	= 1031;		// Boolean  read/write - set/reads the Use Document Class visibilities settings for dlvps - Public for VS
    const short ovViewportDescription			= 1032;		// TXString	read/write - a description for the viewport, which corresponds to the Dwg Title field for a corresponding Drawing Label. - Public for VS
    const short ovViewportLocator				= 1033;		// TXString	read/write - the locator for the viewport, which corresponds to the Item field for a corresponding Drawing Label. - Public for VS
    const short ovViewportIsLinked				= 1034;		// Boolean	read - indicates whether the viewport is a linked viewport
    const short ovViewportDisplayPlanar			= 1035;		// Boolean	read/write - the flag to indicate if planar and 2D objects are to be displayed
    const short ovViewportForegroundRenderType	= 1036;		// short	read/write - the viewport render type. - Public for VS
    const short ovViewportHasCamera				= 1037;		// Boolean  read only  - whether there is a camera attached to the viewport or not
    const short ovCameraAttachedToViewport		= 1038;		// Boolean  read only  - whether the camera is attached to a viewport or not
    const short	ovViewportCropVisible			= 1039;		// Boolean  read/write - get/set the Crop Visible state of a viewport - Public for VS
    const short	ovViewportLayerHeightIgnored	= 1040;		// Boolean  read only -  whether the viewport ignored layer height for single layer case
    const short ovViewportLightingDevice		= 1041;		// read/write - make an association between a lighting device light and an overriden light object for the viewport.
    const short ovViewportRePositionDimensionText	= 1042;	// Boolean  read/write - the viewport/dlvp re-positions dimension text to other side of dimension line - Public for VS
    const short ovIsDesignLayerSectionViewport	= 1043;		// Boolean read only - indicates whether the linked viewport is a sheet layer or a design layer viewport - Public fo VS
    const short ovFDLSVPHiddenLineInWireframe_OBSOLETE	= 1044;
    const short ovViewportPageSymbolScale		= 1045;		// double	read/write - the viewport page symbol scale. - Public for VS
    const short ovViewportNavigateToFromSectMarker = 1046;	// Boolean	write only - selects the viewport and makes it visible - Not for public use
    const short ovViewportDetailLevel			= 1047;		// short read/write - low detail = 0, medium detail = 1, high detail = 2 - Public for VS
    const short ovViewportIsHorizontalSection	= 1048;		// Boolean	read - indicates whether the viewport is horizontal section
    const short ovViewportTransformMatrix		= 1049;		// TransformMatrix	read/write
    const short ovViewportViewMatrix			= 1050;		// TransformMatrix	read/write
    const short ovViewportOperatingTransform	= 1051;		// TransformMatrix	read
    const short ovViewportUnscaledBoundsWithoutAnnotations	= 1052;		// WorldRect  read
    const short ovViewportResetForOnlyAnnotationsChange = 1053; // void write
    const short ovIsSectionViewport				= 1054;		// Boolean read only - indicates whether the viewport is a section viewport - Public for VS
    const short ovSheetLayerSectionViewportViewMatrix	= 1055;		// TransformMatrix	read
    const short ovSectionViewportSectionViewMatrix = 1056;		// TransformMatrix	read/write
    const short ovViewportAttachDefaultRenderOptions = 1057;	// Boolean(ignored) write
    const short ovViewportAttachDefaultCustomRenderWorksRenderOptions = 1058;	// Boolean(ignored) write
    const short ovViewportDisplay2DComponents	= 1059;	// Boolean read/write
    const short ovViewportHiddenLineDisplay2DFills		= 1060;	// Boolean read/write
    const short ovViewportAttachDefaultLightingOptions	= 1061;	// void write
    const short ovViewportCreateDefaultEditableGroups	= 1062;	// void write
    const short ovViewportPrivateLayer					= 1063;	// MCObjectHandle read
    const short ovSectionViewportDisplayObjectsBeyondCutPlane	= 1064;	// Boolean read/write
    const short ovSectionViewportDisplayObjectsBeforeCutPlane	= 1065;	// Boolean read/write
    const short ovViewportHiddenLineDisplay2DFillsAllowed		= 1066; // Boolean read
    const short ovSectionViewportCastShadowsFromRemovedPortion	= 1077;	// Boolean read/write
    const short ovSectionViewport2DResultsMerged				= 1078;	// Boolean read/write
    const short ovSectionViewport2DAttributesUseClass			= 1079;	// Boolean read/write - must be set true before you set class with ovSectionViewport2DAttributesClass
    const short ovSectionViewport2DAttributesClass				= 1080;	// RefNumber read/write
    const short ovSectionViewport2DOtherAttribsUseClass			= 1081;	// Boolean read/write - must be set true before you set class with ovSectionViewport2DOtherAttribsClass
    const short ovSectionViewport2DOtherAttribsClass			= 1082;	// RefNumber read/write

     

  2. Is there a custom user origin? I can't remember off the top of my head, but a number of functions always use the internal origin. You need to get the user origin and offer your coordinates by that amount. You may also have to take rotated plan into account.

    • Like 1
  3. It's been a couple years since I experimented, but when I last checked, they way Data Tags copy objects from their profile group (where layout objects are stored) to the object didn't work with PIO's. If I remember correctly, it basically gets converted to group before it gets copied.

  4. You seem to be describing a Plug In Object. PIOs will create their own insertion tool, with the interface for a point PIO being very similar to the symbol insertion tool. 
    The script component for a simple PIO should draw the elements you want to display, with the origin of the scripted elements being the insertion point of the object (like a symbol definition). 
    Your script can insert a symbol at the origin. You can also code all the geometry of the elements you want to draw, and it will appear symbol-like to the user. 

    • Like 1
  5. If it’s for a document-wide setting, you don’t have to attach the record to anything— just use the default field values to store your data. You can get a handle to a record definition by its name. 

    • Like 1
  6. Seconding Pat's suggestion. Create symbols instead of viewports. Once you're ready to start assigning control data, Convert to group (this is a named command, not to be confused with Group to Ungroup).

     

    You can think of a viewport as a smart photocopy -- a way to duplicate a drawing element for presentation or to show an alternate position.

    • Like 2
  7. 1 hour ago, spettitt said:

    I like the idea of a hidden record - for this and other things. @JBenghiat is there anything to know with making a record hidden, please? From what I can see it involves a double underscore, but I don't know if that's a cause or a symptom.

    The double underscore will hide a field. To hide a record, use SetObjectVariableBoolean on the record format with the selector 900. (True is hidden). Usually I check if the record exists, if not, create it, then hide. The record otherwise functions as usual, and you can create a script to toggle visibility as you're testing.

  8. Files definitely do not have unique id’s. In fact, I think that’s a feature— if you were to save a backup or a named version, you would want the file to be identified the same. 
     

    Storing a UUID in a hidden record would be the way to go, but you would need some kind of manual connection setup between the file and database. 

    • Like 1
  9. You’re creating a bundle, though you may also want to start with the EmptyModule or TesterModule component example and build from there. 
     

    Last time I tired, I still needed to change some project and build settings to get things to compile and run, but that was a while — I have custom xconfig files adapted to my development file structure and flow. 
     

    I’ve recently started migrating to a cmake workflow. After getting past the learning curve, setting up new projects, supporting multiple Vectorworks versions, and working cross platform has become much easier. 

    • Like 1
  10. You still need to define the object being extruded, so don't omit the BeginPoly/EndPoly calls

     

    GetCustomObjectPath works on Plug-in objects -- that won't get the extrude base, as an extrude is a native object type. Use OffsetPoly after EndPoly and before EndXtrd.

  11. I think want to use AddPoint() or Add2DVertex() in your polygon. Also make sure to call SetPolyClosed() to ensure it is a closed object and can extrude. By your screen shot, it looks open.

     

    Using DoMenuText calls in code that also uses handles can be problematic and is definitely not reliable in a PIO.

  12. Not entirely sure what you’re describing. 
     

    Tools>plugins>run script will run a text file as a script 

     

    You can also create a script in the Resource Manager and run from a script palette. It saves with the file, not as a plug-in. 

  13. Short answer -- no. The clip club is just essentially a view. The criteria is actually looking at a visibility flag that's set on objects (which really dates from pre-viewport days) and their containers (i.e. whether their containing layer is set to visible). Your worksheet isn't going to change if you're zoomed in on a group of objects, for example. The Clip Cube doesn't change any visibility flags, it just filters what gets displayed on screen.

     

    From a script standpoint, you could retrieve the clip cube, get its location and dimensions, then parse objects and test if they exist within the cube -- but that is not a small task.

    • Like 1
  14. 22 hours ago, FMA said:

    This might be a little bit complicated to get around. Is there any way to activate a tool with a key stroke, or to get access to the normal program functions during a loop? Would be great if anybody knows if that is possible. I can share the whole code if needed.

     

    No, not in Vectorscript

    • Like 1
  15. Thanks Andy and Sam! ProjectionViz 2 will rotate the projector to the tilt and generate the hybrid Top/Plan view. It will also let you choose the floor plane for visualizing the projector cone (as well as correctly displaying key stoning and lens shift). The Video Screen tool is going to give you a lot more options for showing the details of the projector mount and screen, while ProjectionViz is more targeted towards planning and visualization. It is currently Braceworks but not ConenctCAD compatible.

     

    https://benghiatlighting.com/software/product/projectionviz-2/#description

    • Like 1
×
×
  • Create New...