Jump to content
Kevin McAllister

Co-ordinates, Insertion Points, Text and Weird Rounding Errors

Recommended Posts

Someone in another forum section asked about how to show the coordinates of a symbol in text as part of the symbol. I made this simple Marionette Object to test whether it was possible in Marionette in a simple way. Out of the exercise came a few questions -

- why do the coordinates have weird rounding errors even if you enter perfect whole numbers into the OIP fields.

- is there a way to find the real coordinates of the Marionette object container from within the script (ie. when I drag the Marionette object around it would register those coordinates). Right now this only works when this is inserted at 0,0 and manually adjusting its position using the OIP.

- how do I get the text object to centre itself? (Text in general is very non-intuitive in Marionette. Just because how VW handles the scripting of text is terrible doesn't mean that the Marionette text nodes need to be terrible too. A wish would be for a text insertion object that given the used control over justification, insertion point etc. right from the start.)

Thanks,

Kevin

ubbthreads.php?ubb=download&Number=16107&filename=Screen%20Shot%202016-08-04%20at%208.58.59%20AM.png

Edited by Kevin McAllister

Share this post


Link to post

One other question - is there a node that gives you the coordinates of the insertion point of an object (symbol, text object, PIO)? I've seen Get 2D Centre and Get 3D Info both used but the insertion point isn't necessarily the centre of these objects.

KM

Share this post


Link to post

I can try my best to answer your questions.

Rounding Errors: This is due to how numbers are stored within vectorworks. We are in the process of having displayed units adhere to the rounding set in the preferences. I haven't yet finished this.

Real Coordinates of Marionette Object: I've attached a file that I hope demonstrates what you're asking for.

Text Centering: I believe the attached file should also help with this. I can look into better improvements on the text node in general so that you wouldn't have to manually script this.

Insertion Point Coordinates: I don't think this is currently set up, but I may be incorrect. There are definitely ways to accomplish this though, with the currently library, if a user sets the object up correctly.

 

CenteredTextWithActualLocation.JPG

CenterTextOnObject_MFarrell.vwx

Share this post


Link to post

Hi Marissa,

Thanks for all the info!

Real Coordinates of Marionette Object: I've attached a file that I hope demonstrates what you're asking for.

The Parent PIO node is super useful to know about.

Text Centering: I believe the attached file should also help with this. I can look into better improvements on the text node in general so that you wouldn't have to manually script this.

Love your workaround. I debated doing something like that but thought I should figure out how to centre justify the text and then move it using the adjusted insertion point. When I ungrouped my original result, the text object had the insertion point at its centre but the script seemed to continue to use the original insertion point for moving.

Kevin

Share this post


Link to post

PS. Is there a known issue using hybrid objects? When I tried working with a hybrid symbol through my original script it ended up at some crazy way off point.

Kevin

Share this post


Link to post

Kevin, now the challenge is to get the 3 points because in another program you can attach 3D co-ordinated to an object and it will follow it around.

This could be useful.

Share this post


Link to post
PS. Is there a known issue using hybrid objects? When I tried working with a hybrid symbol through my original script it ended up at some crazy way off point.

Kevin

Which view were you in when you ran the script? We've had some issues running scripts in 3D views, Top/Plan is the most reliable.

Not sure that this is the case, but it may be.

Share this post


Link to post

Alan,

Here's the start on a 3D point reference. This will always reference the bottom centerpoint of the cylinder.

There are a few things that I need to mention - in a 3D view, you will not see the text object displaying the coordinates. This is because Marionette actually creates hybrid objects automatically. Anything that is 2D will only be shown in Top/Plan if there is also a 3D object in the script. (in this case, text is 2D, cylinder is 3D. I copied the circle within the script to keep the 2D representation and only extruded one of the circles.) I'm trying to think of a way to also show the text in a 3D view, it may have to do with changing the text from screen plane (which is where Marionette draws 2D objects) to layer plane.

If you move this object in 3D, it is very likely that the text will be offset from the circle in top/plan. This is something we are working on internally, but it is unlikely it will be resolved for 2016. This can be somewhat remedied by moving the circle in top/plan which will reset the association between the two.

Edited by MarissaF

Share this post


Link to post

Marissa,

When I was originally experimenting, the symbol I was using was 3d only so I assumed I should use the Get 3D Info node to find my point. That's when I was getting weird numbers and erratic results. The 3d symbol doesn't actually display in Top/Plan.

Kevin

Share this post


Link to post

That follows my explanation in my previous post. The 3D object will not show in Top/Plan because Marionette creates 'hybrid' objects. I'm not positive, but it's possible that if your referenced symbol was a hybrid symbol that it may display its 2D part in top/plan.

The weird numbers is likely due to moving the object in 3D rather than top plan (which obviously is annoying because you can't place things accurately in Z with just top/plan...)

I don't know if any changes are in-line for how 2D vs. 3D is displayed within a Marionette object, but the offsetting of 2D objects when edited in a 3D view is being extensively worked on.

Share this post


Link to post
That follows my explanation in my previous post. The 3D object will not show in Top/Plan because Marionette creates 'hybrid' objects. I'm not positive, but it's possible that if your referenced symbol was a hybrid symbol that it may display its 2D part in top/plan.

This is really interesting to know. I would recommend putting this in bold somewhere near the top of the documentation.

It also explains why I was getting confused. My other script worked fine with 3d symbols. Its the introduction of text, which is a 2d object, that is creating the current behaviour. The text has become the 2d portion of the resulting object, while the 3d symbol has become the 3d portion.

Kevin

Share this post


Link to post

Marissa,

Hi, can you explain why the script that i added will show the text in 3d and not the one on the cylinder.

It would be great to have the text show in 3d.

Thanks

Share this post


Link to post

Alan,

I think it has to do with the Set Text Orientation node in your script. You're feeding it a 3d point value and its turning the text object from a Screen Plane object to a Layer Plane object. The Text Node seems to default to creating a 2d Screen Plane text object.

There may be another thing going on here too but I can't confirm it. Because the Marionette object is inherently hybrid, the 3d cylinder is created first and the Text node creates 2d text, I think the text object is being sucked into the 2d portion of the hybrid automatically. Any later actions to make it 3d seem to fail (e.g.. if the Set Text Orientation node is fed a 3d value).

Kevin

Share this post


Link to post

That seems to be what's happening. I was able to intercept and change the text to a planar object but I can't seem to get it to respond to a Z value. It also gets confused when you drag it and the text disappears.

Here's the result.

Kevin

Share this post


Link to post

Way to go, its great to have others working with Marionette and bouncing the ideas around, I learn so much.

It becomes a sharp learning curve but I can get stuck at the corners a lot and then someone then says try this and boom you are away.

Hope more join it because its been hard learning, but the few currently working with marionette are great, we just need more to get involved.

It was interesting as I was trying to place the text on the top of the object in 3d i noticed that it did not show in to pl mode but when i added a duplicate node it showed in both.

Still would be nice to have it on top of an object.

Edited by Alan Woodwell

Share this post


Link to post

Continuing on with this....

Here's another version based on an example from the user in the other forum. I can't for the life of me get it to work properly. If you run the script on its own, it generates the proper objects and an error. If you run it in a Marionette node it doesn't move the text or rotate the whole object, but it doesn't generate an error.

Marionette needs a lot of work to make it more user friendly. I should be able to use the debug mode inside a Marionette object. And the errors need to mean something....

Text objects are so frustrating. Its definitely linked to the hybrid nature of the Marionette object.

How do you generate a text box with more than one line of text in it? All I can get is separate text boxes stacked on top of each other.

Thanks,

Kevin

Share this post


Link to post

Kevei,

Hi, I think the problem was the error message said its not a 3D handle and the move node had a reference to 3d so i took that out so it was a 2d only and seems to work.

I read the error messages and they do tell you things.

Interesting if you change the text size from the text dialoge at top of screen the text position reads goes to 0,0 then move the object and resets.

In the _001 file I have formatted the text but have lost the second row, Got to run so will look at it later.

HTH

Edited by Alan Woodwell

Share this post


Link to post

Thanks Alan. I appreciate you taking a look but I'm not sure you're understanding the desired output.

If you run the script outside the Marionette object you'll see what the desired visual result is. I've attached an image too. The text should be moved to the bottom of the marker vertical line and the whole marker (crosshair plus text) should be able to rotate. As soon as it is made into a Marionette object the text move and rotation fail. I think its all because of the hybrid nature of the Marionette object, not because of the Marionette network. (The error that occurs when you run the script outside of the Marionette object is because there is no parent object to reference.)

Kevin

ubbthreads.php?ubb=download&Number=16144&filename=Screen%20Shot%202016-08-06%20at%205.38.27%20PM.png

Edited by Kevin McAllister

Share this post


Link to post

Here's a more successful version of the script. What I learned -

- don't use the Rotate node on Symbols. Not sure why, but its not reliable.

- use Set Text Orientation to move text.

- use Get Symbol Location to find the insertion point of the originating Marionette Object. This may be a different location to its 2d Object centre.

- use Print List to generate a text object with multiple lines of text.

What's not clear to me -

- why Set Text Orientation seems to rotate the text object around a different point than rotate does.

Many times I came up against the hybrid object issue. I'm not sure I want my Marionette to be a hybrid object. I think I would rather it be a group style container instead.

The Marionette library certainly needs more clarity about which transformation nodes (Rotate, Transform2, Rotate3d etc.) work safely on what type of object. Its all very convoluted and can cause things to dump into the 2d or 3d component of the Marionette object unexpectedly. Man, will I be glad when the Screen Plane / Layer Plane debacle is finally gone for good.

Kevin

Share this post


Link to post

Kevin

I knew you'd figure it out!

Just curious: Why did you go for creating text instead of writing to a database field?

Nice work.

mk

Share this post


Link to post

Michael,

I'm not that comfortable with all the database stuff in VW. I've cobbled together a few things in the past but I've always learned how while doing it and then promptly forgotten again. I can see there might be advantages to doing it and I might get inspired to update my automated fly index even more.

I think the advantage here is the symbol could really be anything. It doesn't need to have a record attached or database linked text to work.

Kevin

Share this post


Link to post

I posted an updated version in the other thread - https://techboard.vectorworks.net/ubbthreads.php?ubb=showflat&Number=231146#Post231146

The new version is document unit aware. I couldn't find a node that would tell me the document units or return a point value with document units so I made something. There are a couple of other custom nodes in this too. They are -

Primary Document Units - described above.

Concat - which combines string values.

Get String Length - tells you the number of characters in a string.

Maker Info - an attempt at putting the version and maker info into the OIP. It doesn't transfer through to the Marionette Object which is too bad. I would love to find a way to version the Marionette Object so you can see what version it is when its selected in the OIP. Because you can't even name a Marionette object like you can a node, they all look the same in the OIP other than the entry fields.

Kevin

Share this post


Link to post

- why Set Text Orientation seems to rotate the text object around a different point than rotate does.

Hi Kevin, When you Set Text Orientation, it always orients around the insertion pt of the text, and this insertion pt can be changed by changing the horizontal and vertical justification. For example, if you change the text to be justified center, the text will rotate around its center. There are two set text justification commands, one that keeps the old insertion point and moves the text, and one that keeps the text where it is and moves the insertion point. I believe the code inside the Set Text Properties node is the second command I mentioned.

Share this post


Link to post

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.


 

7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114

 

© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.

×
×
  • Create New...