Jump to content

JBenghiat

Member
  • Posts

    2,016
  • Joined

  • Last visited

Everything posted by JBenghiat

  1. @Hippocode I’m just curious where you’re storing the cursor values so you can retrieve it after the event, especially when multiple objects are selected. A custom parameter seems like the easiest option, but that seems like a lot of overhead.
  2. Ah yes, I misread the directions of the offsets. The drop shadow attribute would only work if the façade were a single polygon with holes. For example, use the inner boundary mode of the polygon tool to create the shape, then apply the drop shadow. So possible, but a bit cumbersome.
  3. While I fully support exploring scripting solutions, it's worth noting you can do this with Drop Shadows in attributes. The offset is in page units. You can set these to be class defaults, and just assign the class to all the objects that you want to have the shadow.
  4. The Series 3 in the library looks like mostly a data update. The size and shape of the units changed pretty considerably, if that's important to you. Here's a comparison of the 36-degree symbols: Also, just to add some complexity to developing symbols, the Series 3 engine also works with the older gate assemblies and both standard and EDLT lens tubes, though the newer gate assembly and XDLT lens tubes are standard.
  5. As far as I know, there is not, other than creating a temporary empty symbol.
  6. @Kraftworks I just tested this, and Modify>Convert>Convert to Group works exactly as you described -- all selected Lighting Devices become symbols. Ungroup will also work in this case. Perhaps you were thinking of Modify>Convert>Replace with symbol.
  7. The symbol should show whatever the default record values are for linked text, and you can access the record attached to the symbol definition. You can either read the field values, store them, change to display values, then restore, or you can cope the symbol definition just for display purposes, then delete. You may have to do a ResetObject() after changing the field values. You can definitely edit a symbol definition via script, but if you want to change the text format in just the one symbol instance, then no, the linked text follows the same rules as any other part of the symbol. If you want each instance to be different, you’ll need to create a plug-in object.
  8. Not necessarily. They will use whatever you have set in Lighting Options which is a document/viewport setting. I’m seeing Indirect set to none in new files. Otherwise, I’m seeing Glow work correctly in all RW flavors.
  9. Is there a way to figure out when dragging an object is complete, and get the location of where the user released the mouse? On first review, the only way I can see to do this is store the cursor location during OnDrag() to a static variable, and then on object move check if that variable has data -- but that seems a little tedious.
  10. The rotation parameter isn't available as well. A feature request is on the books for that. Ideally, every parameter for a light would have object variable access.
  11. Good point. You need to insert at least one light, and it can be off, if you want to turn off the default light. It should. If you're not seeing the glow emit light, see my note above about bounces. In Lighting Options, you won't see the glow if Indirect Lighting is set to None. You need at least one bounce.
  12. You need to apply a texture to the object with a glow reflectivity. You can create a new Renderworks Texture in the Resource Manager, and then edit it. Under Reflectivity, select Glow. In the Glow options, enable Emit light. Apply the texture in the Render tab of Object Info, by dragging the texture to the object, or using the Texture Tool. You do not need any additional lights for the glow, but you do need to be in wither Renderworks or Redshift, and you need your Lighting Options set to at least one bounce.
  13. Yes, this is known/expected. Vectorworks preserves the Python session and caches any imports. There’s been a couple threads on the subject:
  14. Double and real are synonymous. They both map to reals. Sint32 is a signed 32 bit integer. It maps to LONGINT. void is nothing, so there is no return. Using the standard SetOV call will probably work, ignoring the second argument. RefNumber is another LONGINT. It should work with Index2Name. I’m not sure what TransformationMatrix would return, if it works. In C, it’s an object that holds the transformation matrix as arrays. Calls marked “public for vs” just means that they duplicate a function elsewhere, but the only way you can access through VS is via an object variable. I think any call will work, it just may or may not return usable data.
  15. I think you'll have better luck using the object variables rather than looking at the cache group: // 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
  16. As everyone has sleuthed out, hidden records are indeed in their own list. This is another instance where the Debug menu and Debug List View Ex comes in handy. Records are contained in a Data object, which contains regular records in it's standard list and hidden records in a Hidden Format container in the aux list. In theory, you could probably get there from FSymDef() and some crafty list traversal, but in VS or Python, Raymond's method is much easier and to the point.
  17. Indeed, that should work. I think when Python came out, that was the only option, and I haven't looked back.
  18. Looks like the process is a little more complex. The link information is attached to a link object in the text object's aux list. This is only possible to access using python: kLinkType = 58 ovLinkFormatUsed = 1350 ovLinkFieldIndex = 1351 auxh = hText.aux hTextLink = vs.Handle(0) while hTextLink == vs.Handle(0) and auxh != vs.Handle(0): if auxh.type == kLinkType: hTextLink = auxh auxh = auxh.next if hTextLink != vs.Handle(0): recIdx = vs.GetObjectVariableInt(hTextLink, ovLinkFormatUsed) fieldIdx = vs.GetObjectVariableInt(hTextLink, ovLinkFieldIndex) recName = vs.Index2Name(recIdx) vs.AlrtDialog( 'Field: ' + recName + ' Index: ' + repr(fieldIdx) )
  19. I think there’s a common misconception that objects don’t get created until the end of the script — for any function that returns a handle, that object the handle points to is immediately available in memory, and all operations using that handle will work. What you won’t see happen until the end of a script is the plug-in object’s code run or it’s geometry created, so if your script depends on the PIO calculating data or parsing it’s geometry, you’ll have issues. There’s a way to force an SDK plug-in to reset immediately, but I don’t think that’s the issue here. Does the name have to be unique? If so, that would cause the command to fail. The name could be set, but you just don’t see it yet. Try calling ResetObj() at the end of the script.
  20. Select everything you want to be considered as a single unit and create a symbol. Set the insertion point to the point where you want to attach to the truss. Do not keep an instance in place. In the Rigging toolset, choose Rigging Load. Attach the Rigging Load to your truss. Check the Show Symbol option, and press Select Symbol to choose the symbol you created. Set the weight of the combined hardware at the bottom of the OIP.
  21. Correct. passing vs.FSymDef() to vs.ForEachObjectInList() is probably the best method. I believe you do have to recursively enter symbol folders.
  22. I'm not entirely sure what you mean here. As Pat remarked, the Resource Manager is only an interface for working with resources. The Lighting Device accepts the name of a symbol (a resource), and copies the geometry of the symbol to the Lighting Device. Lighting Devices also take default data from the symbol on insertion, which you can mimic via script by calling vs.ApplyLightInfoRecord(). An "external reference" in Vectorworks lingo would mean that you are referencing a symbol in another file. Is that what you mean, or are you only trying to determine the connection between the Lighting Device and the Resource Manager. Mapping to a symbol outside of the current drawing file would be where Sam's RessourceList comes in. The following script will add the first row as described, assuming that "D" maps to a symbol named "My Light." It also assumes that the symbol exists in the current drawing. The neutral orientation (pan=0) is towards the top of the page. You can set a different initial orientation with the final parameter in CreateCustomObject(). symbolName = 'My Light' hNew = vs.CreateCustomObject('Lighting Device', (-61,-7.55), 0) vs.Move3DObj(hNew, 0, 0, 11.5) vs.SetRField( hNew, 'Lighting Device', 'Symbol Name', symbolName) vs.ApplyLightInfoRecord(vs.GetObject(symbolName), hNew) vs.SetRField( hNew, 'Lighting Device', 'Pan', '-7') vs.SetRField( hNew, 'Lighting Device', 'Tilt', '46') vs.ResetObject(hNew)
  23. @Sam Jones why not just use vs.GetObject() to get the symbol definition by name and vs.GetTypeN() to confirm that it's a symbol definition? Then all the Lighting Device needs it the name of the symbol.
  24. You could always define the ptr in ModuleMain and then initialize if nullptr in the OnInitXProperties events. That's assuming that you don't need to re-initialize if the user makes a change to the color table.
×
×
  • Create New...