Jump to content
Developer Wiki and Function Reference Links Read more... ×
Sign in to follow this  
VectorBub

Where can I find "object property index" list

Recommended Posts

I've just started poking around with scripts, and I'm trying to do something I thought would be pretty simple: create a script to increase the radius of all selected circles.

The script correctly loops through all arc/circle objects (GetType(h)=6) and I can have it display the radius using HWidth(h)/2 and add the user's input change value, add them and display the correct new value to set --- I just can't find any way to set the radius. HWidth does provide a correct value, but it's read-only.

It looked like there might be a specific Set function for radius, but I don't see one. I tried GetObjectAttributeReal -- but it asks for a property index. I don't know what to enter, and I can't find any listing anywhere. I don't really think the radius is an attribute anyway. It's part of the object info palette, not the attributes palette. (I even tried looping through index 0 to 10000, setting the script to stop when it found a match for the current radius. No luck.)

I've been searching for two days, and my emoticon accurately describes my current emotional state.

Anyone?

(And where can I find the object property index listing?)

Edited by VectorBub

Share this post


Link to post

With circles, "scale (x, y)" would probably work well.

Since I'm dense, I would:

1. create an array of handles

2. ForEachObject criteria (sel=True) --> populate array with the handle of the selected objects

3. deselectall

4 While LOOP select array element, scale it, deselectall.

Alternatively:

1. get center of existing circle

2. draw new circle of desired size at the locaton

3. delete old circle.

The downside of the alternative is that it will not preserve entity names and stacking order.

Share this post


Link to post
I've been searching for two days, and my emoticon accurately describes my current emotional state.

Anyone?

(And where can I find the object property index listing?)

The (documented) Object Variables are listed in the Additional Resources of VS Reference. There's no such thing as an ObjectAttributeReal.

Get/SetBBox should work in your particular case.

Share this post


Link to post

As an alternate solution and if they are all circles or 360 degree arcs, yo can use SetBBox:

{Get center of original circle}

GetBBox(circleHdl,p1X,p1Y,p2X,p2Y);

centerX:= (p1X+p2X)/2;

centerY:= (p1Y+p2Y)/2;

{Change the circle radius}

SetBBox(circleHdl,centerX-rad2,centerY+rad2,centerX+rad2,centerY-rad2);

Share this post


Link to post

Ahh, a good point, Miguel!

Off the top of my head, I can't devise a routine to scale an arc segment. Surely it is doable, but not obvious.

(I might first make the arc 360?, then change the BBox, finally reset the original angles. Off the top of my head?)

Share this post


Link to post

Did either of you try SetBBox on circles? I did before I posted last night and it does not work.

It does work on ovals, but not on circles.

Do you have a trick?

Share this post


Link to post
Ahh, a good point, Miguel!

Off the top of my head, I can't devise a routine to scale an arc segment. Surely it is doable, but not obvious.

(I might first make the arc 360?, then change the BBox, finally reset the original angles. Off the top of my head?)

Once you sweep an arc object 360 degrees it becomes a circle object according to the OIP.

Share this post


Link to post
Did either of you try SetBBox on circles? I did before I posted last night and it does not work.

It does work on ovals, but not on circles.

Do you have a trick?

It doesn't? Not even on arc segments? (Should test myself, I know!) Well, blimey!

Share this post


Link to post

I just tried SetBBox on an arc and it does not change. The VS Doc says:

Procedure SetBBox positions objects whose geometry is defined by a bounding box. These objects currently are Image, PICT, Rectangle, Oval, Rounded Rectangle, and Worksheet Container.

Ray,

Do you know when the HScale functions were added? I am pretty sure they are farily new and were not there when I wrote my scale objects script in 2007.

Share this post


Link to post

No, it doesn't!

As comes to HScale: what HScale? Not documented?

An excerpt from VW2010 VS Function Reference:

GroupToMesh

H

HAngle

HArea

HasConstraint

HasDim

HasPlugin

HCenter

HDuplicate

Height

HExtrude

HHeight

Hide

HideClass

HideLayer

HLength

HMove

HMoveBackward

HMoveForward

HPerim

HRotate

HUngroup

HWallHeight

HWallWidth

HWidth

I

ImportResourceToCurrentFile

Share this post


Link to post

Hi Pat,

???hScale2D - born on version - VW 10

???hScale3D - born on version - VW 12

I recently went through the VS Func Refs and the "backwater documentation*" to determine when things appeared (and disappeared). This was a little OC on my part, but good info if you really want to know.

Raymond

* VWPluginLibraryRoutines.p, in the user's plugin folder.

Share this post


Link to post

I appreciate the help. Thanks.

With circles, "scale (x, y)" would probably work well.
As it happens, I need to increase the radius of all circles by 2 mm, regardless of their size, so I'm not sure I can use the Scale function for this. A Scale function probably doesn't have an option for specific mm increase. I can't say for sure, however, because I can't locate any documentation on Scale. Where did you find that?

The second alternative could work---but I don't like it. Entity names and stacking order aren't the problem. These circles have all manner of different attributes, so re-creating them would be a lot more work (I think) than just creating a new default circle. I'd like to find a way to edit the radius of the existing circles, if possible.

(I don't think density enters into the matter.)

Edited by VectorBub

Share this post


Link to post
The (documented) Object Variables are listed in the Additional Resources of VS Reference. There's no such thing as an ObjectAttributeReal.

Get/SetBBox should work in your particular case.

You're correct. I meant to say "GetObjectVariableReal".

The Annotated Function Reference says:

VS:GetObjectVariableReal

FUNCTION GetObjectVariableReal(h:HANDLE;index:INTEGER):REAL;

Parameters:

h HANDLE Handle to object.

index INTEGER Object property index.

Where do I find the "Additional Resources of VS Reference"? Are the Object Variables listed there, and is that what is meant by Object property index?

Share this post


Link to post

A link to additional resources is in the top left frame of the VSFR. That opens another frame with the VectorScript Appendix.

Documentation of HScale is on the VW Developer site

There are almost 200 VS-functions there that are not included in the ref guide that comes with VW (ie. almost 1700 functions?)

It is surprising that there isn't a function to change the radius! Since I do mainy parametric objects, I had not realised it.

You can calculate the scaling factor using GetBBox.

Share this post


Link to post
(I don't think density enters into the matter.)
????????Matter without density, now there's an interesting concept.

VectorBub,

A Scale function probably doesn't have an option for specific mm increase.

???You are right, so you should build your own. To add a fixed amount to a circle, you need to know its starting diameter. The ending diameter is the starting diameter + 2 * (radius increment).

???A nice way to implement this is by defining a function that accepts an increment and returns a scale factor; This is especially useful since your circles do have different diameters.

function GetScaleFactor (H :Handle; RadiusInc :Real): Real;

{ Return the scale factor needed to change a circle's diameter by a fixed amount. }

Var

???StartDiam, EndDiam :Real;

???X1, Y1, X2, Y2 :Real;

Begin

???GetBBox(H, X1, Y1, X2, Y2);

???StartDiam := X2 - X1;

???EndDiam := StartDiam + 2 * RadiusInc;

???GetScaleFactor := EndDiam / StartDiam;

End; { GetScaleFactor }

???To use it, you already have the center XY from hCenter:

hCenter (H, X, Y);

ScaleF := GetScaleFactor (H, 2mm);

hScale2D (H, X, Y, ScaleF, ScaleF, False);

???Watch your units. Other than that, this will work every time.

Raymond

Share this post


Link to post
I appreciate the help. Thanks.

With circles, "scale (x, y)" would probably work well.
As it happens, I need to increase the radius of all circles by 2 mm, regardless of their size, so I'm not sure I can use the Scale function for this. A Scale function probably doesn't have an option for specific mm increase. I can't say for sure, however, because I can't locate any documentation on Scale. Where did you find that?

The second alternative could work---but I don't like it. Entity names and stacking order aren't the problem. These circles have all manner of different attributes, so re-creating them would be a lot more work (I think) than just creating a new default circle. I'd like to find a way to edit the radius of the existing circles, if possible.

(I don't think density enters into the matter.)

You could calculate the new scale.

On the other hand if you don't need to maintain names...this would be common...you could call the offset tool.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

 

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.

×