Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

87 Excellent

About JBenghiat

  • Rank
    500 Club

Personal Information

  • Homepage
  • Location
    NY, NY

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. JBenghiat

    What does GetSelectedResourceIsDocument do

    This should test whether the selected resource is document-based. I thought this meant that it was in the current file, though it’s possible it could be document vs cloud.
  2. Do you mean for AlrtDialog? You should be fine entering any data here, and in fact the arguments don't need to be strings, like Message() in VS. Or are you thinking of the fact that PParamName doesn't update after SetRField( ParamName )? As we're dealing with symbols and records, that doesn't even apply here.
  3. JBenghiat

    GetPtL (VW2013) not collecting point values

    You could maybe try RunTempTool() to get your control point value. You're going to have to make sure that you only run the tool if the object is being inserted (IsNewCustomObject) AND the object is not in preview (GetParent(PIO_Handle) <> nil). Unfortunately, these aren't true at the same time (though I didn't confirm with event enabled objects looking at states), you have to do something like (edited for brevity): if IsNewCustomObject then SetRField( '__IsNew', Concat( TRUE) ); if P__IsNew then SetRField( '__IsNew', Concat( FALSE) ); if GetParent <> nil THEN run tool Otherwise, you're going to need to make a separate tool for placing pickets. That could also help solve your left / right issue, as your placement tool could determine whether to flip the object.
  4. The example you have is for a plug-in object. If you're just dealing with linked-record symbols, the script can be a little simpler. # This gets a "handle" — a runtime object ID — to the first selected object on the active layer. hObject = vs.FSActLayer You mentioned a group of symbols — that makes this a little more difficult, as you need to get a handle to the symbols in your first selected object. You can either get the first object in the group with vs.FInGroup(hObject) and then iterate through the group, use one of the ForEachObject routines to iterate through every object meeting your specifications, or use the "waldo" technique (there should be some posts in the archive on this) to find your place in the document. If you don't mean a literal group of symbols, then cary on. # Get the value of the field. You didn't mention the name of the record, so there is a placeholder fieldDataS = vs.GetRField( hObject, YOUR_RECORD_NAME, 'Deckenlast' ) # This always returns a string, so you need to convert it to a number ok, fieldData = vs.ValidNumStr( fieldDataS ) if not ok fieldData = 0 ValidNumStr deals well with units and separator preferences, so is going to be the most robust option versus vs.Str2Num or eval(). You may want to write your own function . def Num2Str( x ) ok, n = vs.ValisNumStr( x ) if not ok: n = 0 return n vs.SetRfield also requires a formatted string argument — use vs.Str2NumF for this
  5. JBenghiat

    Creating a paper lantern glow... HELP!

    Just so summarize, you have three options: - Use an image from your research. Set the reflectivity to Glow but not emit light. This will make the texture evenly lit and ignore the scene lighting. (This is the default setting for image props). Turn off receive shadows. This is going to be your fastest and most predictable option. - Have glow reflectivity emit light. This will make the lantern cast light on the scene in Renderworks. You must have your lighting settings to use at least one bounce. This will combine control and realism. - Set the reflectivity to Backlit and insert a point source in the lantern. This is the only scenario where you need an actual render light. This will give you more of a simulation than the other options.
  6. JBenghiat

    2D Components for Hybrid Objects (but not for Spotlight)

    Sadly, this feature does not yet work with Spotlight. Lighting Devices don’t actually insert a symbol instance but rather extracts and manipulates symbol geometry. As such, even if a symbol has a 2D component, it won’t display in a lighting device. 2D components won’t solve your vertical position issue, only allow for more effortless sections. I’ve had a number of conversations about how Vectorworks can better draw non-horizontal positions. It’s definitely something on the radar. In in terms of calculations and planning, I’ll give a shameless plug for Beamdraw, which lets you plan and visualize before creating any lighting devices, focus points, or positions: https://benghiatlighting.com/software/products/beam-draw-4
  7. JBenghiat

    GetPtL (VW2013) not collecting point values

    I almost always use constants or variables for SetRField, so you shouldn't have any problem doing so. Looking further into this, you have to make sure the tool doesn't run while creating the preview of the object and the tool collection runs at the end of the code. There are some ways around this, but I think it's a lot for your coding level. You're better off with an insertion tool here. As a side question, is there a reason you need each picket to be a separate object? You could have a line PIO that defines the top or bottom rail, and automatically draw the other rail and the pickets between them.
  8. Your easiest approach is to link the text to a record field (see the help guide for Link Text to Record). Then, you can write a simple script using vs.SetRField and vs.GetRField to write and read the data.
  9. JBenghiat

    GetPtL (VW2013) not collecting point values

    The issues you are seeing with Message are mostly a function of how Message and plug-in events work. Your plug-in code is going to run several times before the actual insertion. For example, the code runs in order to generate the object's preview when you first select the tool. The Message displays PControlPoint01Y, which is a constant loaded at the beginning of the script's run. If you're updating the value with SetRField, you would only see the new value with GetRField. As you do here, ignore the PParam value and just use cpHeight for your script. You only set the value of cpHeight if the object is new. You want to execute cpHeight.y := PControlPoint01Y before the IF IsNew… block. This may not impact your code, but two tips: The record name is going to be PIO_Name. This can prevent errors with Set/GetRGield. You can use Num2StrF to change the real to a string. This will properly format it to deal with units indicators and you don't have to worry about the accuracy parameter.
  10. JBenghiat

    Setting render mode from plug-in

    I have a button that changes to a 3D view based on the plug-in's orientation. I can't get the render mode to change. I've tried: gSDK->SetRenderMode(gSDK->GetActiveLayer(), renderOpenGL, true, true); gSDK->NewCurrentViewMatrix(viewMatrix, true); WorldRect drawRect; ViewRect windowRect; gSDK->GetScreenSize(windowRect); gSDK->ViewRect2WorldRect(windowRect, drawRect); gSDK->RedrawRect(drawRect); in various orders, but the render mode always stays as is. The RW camera successfully changes render modes, so this must be possible...
  11. Here's the direct link: http://developer.vectorworks.net/index.php/VS:Similar_Objects_Creation Though on reexamination, it only benefits the create similar operation, so may be more trouble that it's worth. Do you have an example of what the finished object looks like? In re-reading your first post, you describe a 2D path, but the third click represents height, so would that be a 3D point? Control points are useful if you want the user to be able to graphically manipulate a position or length value rather than or in addition to entering it in the OIP. If what you want is a way to collect user input on insertion, then the control point won't really be useful. If you want an easy way to edit the object after insertion, then use a control point. One other thought — if your object is event enabled and you check for a created object, or if you check for IsNewCustomObject() on reset, you should be able to use GetPt() to ask for user input. Just be very careful with UI elements in the reset code — you don't want to accidentally trigger the UI action when you have a bunch of object instances selected, all regenerating.
  12. You have to create a separate tool for placement. Tools in vs have some limitations, but it should work for you. The Developer Wiki has an article on linking a PIO to a tool.
  13. JBenghiat

    Help with Swap Panes

    Without digging too much in the code, your case statement uses 4 instead of 5. You may may want to get in the habit of using constant for dialog item ids. It helps eliminate some errors where you get your ids confused.
  14. JBenghiat

    Add tool Preferences to SDK tool

    Is this an insertion tool for an object, or just a tool? If the former, you can just link the tool to the object with the /*ParametricName*/ value in the tool definition. If it's a standalone tool, decide if the preferences will be application or document specific. If application, use Get/SetSavedSetting() to store values. If per document, you need to create a hidden record format and store values to the record attached to nil. (That will store to the record definition in the document header). Either way, you will have to write your own dialog for user interaction.
  15. JBenghiat

    Is the search in developer.vectorworks.net broken?

    It appears to be. I filed a bug report — there is probably an update needed to work with Google search. The error is with full site search. The wiki search (bottom half) still works, but you have to be more accurate in your search terms. For example, GetName will produce results.