3DC 7.2 Alpha 3 Available

So, you are scanning the lists of fields? You don’t just need to convert a field name into an ID? Such as:

GetMaterialCustomFieldID(CustomFieldName As Variant) As Variant

I need to add the ‘GetxCustomFieldID’ functions, that’s for certain. I’m not sure I want to expose the others for scripting anymore. But, you can do this via the CSG. I can explain how.

My material manager plugin shows a list of available custom material fields.
It’s a bit of an odd one.

The rest of the time I just need to get the ID from the name (and to add the field if it’s not there)

For the next alpha, I’ve removed the GetRepresentativeEntityType and GetShapeType (‘GetType’, ‘GetSubType’) methods from the Shape object. They aren’t necessary anymore because the GetShape functions will only return modifiable shapes.

Paul,

I’ve added the ‘GetxCustomFieldID’ functions.

You’ll be able to do the rest via the CSG.

The conversion process is going smoothly for most so far. Fixing 1 or 2 bugs along the way.

Is it worth me taking a look at the operations too?

Good to hear. My experience has been that it is pretty straight forward. But, it does take some work.

Maybe it’d be better to wait for the next version before doing operations. I’m still making changes to the CSG.

Is Scene.GetSelectedGroupsCount the same as the old GetActiveGroupCount?

It seems to return 0 most of the time whereas in the old API if an object was selected, there was an active group too (the objects parent group)

Will we be able to use the hierarchy view to select group that contain no objects? (not available in 7.1.2)
Currently I get lots of error 91’s <!– s:) –><img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile" /><!– s:) –>

Also I notice the Group.SetPosition doesn’t seem to be working yet.

Apart from that – still progressing well with the conversions.

The plan is to allow groups to be selected via the hierarchy.

So, groups are no longer ‘active’ unless they have been selected individuall via the Hierarchy (not working yet).

The old active groups was just the parents of the active objects. So, just Object.GetParentGroup will get the active group.

As for SetPosition… I’ll have to take a look. It seems to me that it should work.

It seems that declarations like:
Dim MyVariable As Double

is only allowed in plug-ins, not in scripts.

The script declaration would be limited to:
Dim MyVariable

resulting in less precision when doing computations.

Is it possible to implement such declarations (As …) in 7.2 scripts?

VBscript doesn’t support types, only variants.

Not sure if you can use type characters though

Dim MyVar#, Str$

# = double
! = Single
$ = string

I realize that the difference is that plugins are in Visual Basic and scripts are in VBscript.
There is only one way to declare variables in 3DC scripts (or VBscript) and the type is determined depending on the context in which a variable is used.

Right?

In fact, the advantage of plugins is the that you can use an input form?

Correct.

Although the other use of scripting is during scene animation. (not useful for train sims)

[BLOCKQUOTE class=’ip-ubbcode-quote’][div class=’ip-ubbcode-quote-title’]quote:[/div][div class=’ip-ubbcode-quote-content’]Originally posted by Paul Gausden:
VBscript doesn’t support types, only variants.

Not sure if you can use type characters though

Dim MyVar#, Str$

# = double
! = Single
$ = string [/div][/BLOCKQUOTE]

One can also use the built-in VarType() function to determine the type of data the variant is holding.

Hello,

For a script, can you please tell if the following changes are correct?

[pre class=’ip-ubbcode-code-pre’]Sub Main (CanvAsApp)[/pre]
replaced by
[pre class=’ip-ubbcode-code-pre’]Sub Main (Scene)[/pre]

[pre class=’ip-ubbcode-code-pre’]ActiveObjectsCount = Scene.GetActiveObjectCount[/pre]
replaced by
[pre class=’ip-ubbcode-code-pre’]ActiveObjectsCount = Scene.GetSelectedShapesCount[/pre]

[pre class=’ip-ubbcode-code-pre’]
ActiveFacesCount = Scene.GetActiveFaceCount
Set ObjectA = Scene.GetActiveObject(0)
Set FaceA = Scene.GetActiveFace(0)
[/pre]
replaced by
[pre class=’ip-ubbcode-code-pre’]
‘ For faces, some check that faces were actually selected
If ( (Scene.GetSelectedShape(0).GetSelectionCount andlt;andgt; 1) OR (Scene.GetSelectedShape(0).GetSelectionType andlt;andgt; CSGSelectFace)…
Set ObjectA = Scene.GetSelectedShape(0) ‘ first selected object
Set ObjectB = Scene.GetSelectedShape(1) ‘ second selected object
Set FaceA = ObjectA.GetSelectionItem(0) ‘ first selected item
[/pre]

[pre class=’ip-ubbcode-code-pre’]
g.GetPosition Nothing, x, y, z
[/pre]
replaced by (if no animation)
[pre class=’ip-ubbcode-code-pre’]
g.GetPosition Nothing, 0, x, y, z
[/pre]

[pre class=’ip-ubbcode-code-pre’]
GroupA.GetOrientation GroupA, DirX0, DirY0, DirZ0, UpX0, UpY0, UpZ0
[/pre]
replaced by (if no animation)
[pre class=’ip-ubbcode-code-pre’]
GroupA.GetOrientation GroupA, 0, DirX0, DirY0, DirZ0, UpX0, UpY0, UpZ0
[/pre]

Some unchanged functions:
[pre class=’ip-ubbcode-code-pre’]
FaceA.GetPointCount
GetRootGroup
GetFaceNormal
GetParentGroup
GetChildCount
GetChild
GetPointCount
[/pre]

You must be logged in to reply in this thread.