Jump to content
Developer Wiki and Function Reference Links ×

Where can I find "object property index" list


VectorBub

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
  • Like 1
Link to comment

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.

Link to comment
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.

Link to comment
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.

Link to comment

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.

Link to comment

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

Link to comment

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.

Link to comment

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
Link to comment
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?

Link to comment

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.

Link to comment
(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

Link to comment
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.

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...