Jump to content

Creating a custom parametric object?


Naos

Recommended Posts

Can someone point me in the right direction?

I would like to create a symbol similar to the revision marker. The symbol would be able to be modified in the Object Info Palette. Will I need to learn how to write a script to create this object? Thanks!

Link to comment
9 hours ago, Pat Stanford said:

This sounds like a perfect task for Marionette.

 

Can you post an example of what you would like the object to look like an what options you would like to have in the OIP? We can probably have a simple prototype running tomorrow.

 

object_02.JPG

object_03.JPG

Link to comment

To do it as a Vectorscript you will need to create a Plug-In Object. I recommend that you start with just a script that will draw the oval and the text. Once that is working you can move that script to the Plug-In Editor and add the Parameters that will be displayed in the OIP.

 

Here is the basic script to draw an oval and a block of text centered in the oval.

 

Procedure Door_Tag;

{October 13, 2017}
{© 2017 Patrick Stanford pat@coviana.com}
{Licensed under the GNU Lesser General Public License}
{Demo Vectorscript code to show how to draw an oval with a text block centered on the oval}
{No warranty expressed or implied. Use at your own risk. Here there be dragons. Use of Vectorscipt may be addictive}

Const	pDoorTag = '101';
		pScale=2;
		
Var		X1,Y1,X2,Y2,X3,Y3:	Real;
		H1:				Handle;

Begin
	OvalN(0,0,1,0,20*pScale,10*pScale);  {Draw an oval at a starting point with a size given by last two parameter}
	H1:=LNewObj;
	GetBBox(H1,X1,Y1,X2,Y2);	{Get the corners of the bounding box of the oval}
	X3:=(X1+X2)/2;				{Calculate the center of the bounding box}
	Y3:=(Y1+Y2)/2;
	MoveTo(X3,Y3);				{Move the insertion point to the center}
	CreateText(pDoorTag);
	SetTextJust(LNewObj,2);
	SetTextVerticalAlign(LNewObj,3);
End;

Run(Door_Tag);

To convert this into a Plug-In Object, first read the VectorScript Language Guide available from this page http://developer.vectorworks.net/index.php/VectorScript

 

Then copy the script from above and paste it into the Plugin Editor, delete the Const section and then in the Parameters section add Parameters named DoorTag and Scale, the "p" before them later in the script will then use the parameters you enter. 

 

The first time you create the object in the Plugin Editor, you will then need to edit your workspace to add the tool that will insert the object.

 

Write back when you are ready for more information.

  • Like 3
Link to comment
2 hours ago, Marissa Farrell said:

 

Honestly, @Pat Stanford, this looks like it would be my exact approach.

 

Dang, I was really hoping I was missing something that would have made it much simpler.

 

21 nodes to 17 lines of VS. And that is counting the Procedure, Run and Begin/End statements.

 

Align Statements in VW2019 would be good. As would some "Math on Points" nodes to avoid the GetXY and Point 2D conversions. As would a generic "Get Point" and Point conversion so that you could use a single node for both XY and XYZ conditions with at least the Z being optional.

 

Thanks.

Link to comment
13 hours ago, Naos said:

 

object_02.JPG

 

13 hours ago, Naos said:

 

object_02.JPG

If you need to edit only the tag text perhaps a symbol with text linked to a record field would do, but I agree that going to the data tab is clumsy. However, one can edit the data in a report, which has advantages as comes to systematising and normalising data. 

 

 

  • Like 1
Link to comment
7 hours ago, Pat Stanford said:

Parameter records from a Vectorscript (or Python) PIO can also be reported and edited in a worksheet.

 

Indeed one can, shame if not from M objects. 

 

However, my point was that if the needs can be met using the built-in functionality, one should not create a PIO. I believe that most users do not know how to create database driven tags in symbols. The simple solution to the issue at hand would be that the Object Info would remain in Data tab mode, either as default (ie. in the last explicitly selected mode) or via an option. The report is a workaround of sorts, but not unproblematic, of course.

 

One of the problems with parametric objects that the programmer can very easily get the serious disease called featuritis and a small and simple scripting job, which produced a working tool as a matter of hours,  becomes a project taking weeks. In the case at hand, there might be a need to use a user-defined symbol as the graphic, add  a leader line of a certain style and so on. An ideal door tag would be associated with the door in question and be able to query & display its parameters. (Did I mention featuritis?) 

Edited by Urbanist
Typo fixed
  • Like 2
Link to comment
  • Marionette Maven

So with my new align node, the network can be reduced to 10 nodes.

I'll work on getting permission to add the newly suggested nodes to VW in the future.

 

I know this doesn't help @Naos because he's still on 2013, but I did want to share anyhow.

 

On 10/13/2017 at 5:55 PM, Pat Stanford said:

As would a generic "Get Point" and Point conversion so that you could use a single node for both XY and XYZ conditions with at least the Z being optional.

@Pat Stanford, you can use the XYZ nodes and skip the XY nodes. I think they were both created in hopes of reducing confusion, but if you wire an XYZ node to a 2D point port, it will only use the XY portion, unless I'm misunderstanding.

 

Marionette_RevisionMarker002_MFarrell.vwx

 

EDIT:

You can do math on points just like this:

pointmath.PNG

  • Like 1
Link to comment

I will try it again, I started with the XYZ nodes and it told me it would not accept an undefined value (or something like that, it was 5 days ago) when I tried to leave the Z blank.

 

You math on points does work, but does not do what you need to center things where you need to add in one direction and subtract in the other.

Link to comment
1 hour ago, Marissa Farrell said:

So with my new align node, the network can be reduced to 10 nodes.

I'll work on getting permission to add the newly suggested nodes to VW in the future.

 

I know this doesn't help @Naos because he's still on 2013, but I did want to share anyhow.

 

@Pat Stanford, you can use the XYZ nodes and skip the XY nodes. I think they were both created in hopes of reducing confusion, but if you wire an XYZ node to a 2D point port, it will only use the XY portion, unless I'm misunderstanding.

 

Marionette_RevisionMarker002_MFarrell.vwx

 

EDIT:

You can do math on points just like this:

pointmath.PNG

Thank for your input. We have one 2016 license and we need to upgrade everyone's workstation soon. I'm looking forward to trying out Marionette and wrapping my head around scripting. 

Link to comment
  • 2 years later...

Hello, 

I am in state of researching what software for me to “land in”. I come from rhino+grasshopper-revit workflow, and finding vectorworks as such promising compact yet complete workflow from design concept to BIM stage. Right now i hardly find vectorworks create custom object such windows and doors as we do in revit family creation. My question is can we create this parametric object in vectorworks? Do i need to have coding skill to make this? 
Many Thanks

Ardillas

Link to comment

@Ardillas Nuh You might get a more informed response by posting your question in its own thread, but I'll give it a try.

My question is can we create this parametric object in vectorworks? Yes parametric objects can be created in VWs.

Windows and doors already exist as parametric tools and can be placed into walls. These are 3d objects. If you require additional functionality that is not available in the current window or door tool, you can create your own parametric tool. Whether the effort is worth the investment depends upon the frequency your office intends to utilize the custom door or window. The best and most flexible parametric objects are created using code but simple scalable symbols (blocks) are also an option. And while dimensions can be linked to objects and utilized to reshape them, the functionality is not the same as Revit where dimensions are utilized as constraints to create reusable parametric models that are commonly exported as library files.

Contact your local VW sales to get a 30 day trial and explore the options.

Link to comment

Whether you need coding skills or not depends on how custom you need your objects to be.

 

VW Doors and Windows are fairly flexible. You can use Object Styles to create a "prototype" of a door or window that will allow the user to modify certain settings while others are locked down. I have not used Revit, but my understanding is that this is a similar idea to what a Family is.

 

If you need to make objects that are not possible using the standard Door or Window objects you have two options. Both the Door and Window have an option to "Use Symbol Geometry". This allows you to basically draw anything that you want and stick it inside a Door or Window object so that all of the standard reports and record data are available as if it was any other object. But you have to make sure to enter the correct data. This works well if you have a single (or a few) special doors in a project.

 

If you need to basically have all the doors/windows in your project be something not easily handled by the standard tools/objects, then you probably want to learn to code in either Marionette (like grasshopper) or VectorScript/PythonScript and create your own objects that will do exactly what you want.

 

Ask again (probably in a fresh thread) if you need more information.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...