• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

FS2002 Scasm Compiled MDL

Messages
305
Country
us-california
Hi,

I'm having trouble working with scenery MDLs created with SCASM.

I want to either add them to a object library, or compile each object to their own scenery BGL with specific coordinates and heading.

So far I've been able to get the .SCA file, but I don't know how to edit it to reflect the coordinates and heading I want the object placed at.

Unfamiliar with FS2002 scenery, any help appreciated! :)
 
Hi

Here are some examples. To make the library the source file looks like this one:

Code:
Header( 1 80 -80 -179 180 )

Set( BUF 1024 )
Set( areamx 1024 )
Set( LINBUF 2048 )

; the first object here
ObjId( 5469BA99 267300F0 022E0DB1 C0F65F5C )
LibObj( PWR 0 SCALE .1 TYPE 1024 NAME Triam_Stairs1 ) 
	VecPoints( m 0
		   48  226    68      0  23169 -23169 ;  0
		   48  226    72      0  23169  23169 ;  1
		   48  222    72      0 -23169  23169 ;  2
		   48  222    68      0 -23169 -23169 ;  3
... and all the rest for this object
	Poly( m 0 31085 -10361 145
		204 205 202 197 
	)
	Return
EndObj
; then all the others without need to specify the IG or Guid
LibObj( PWR 0 SCALE .1 TYPE 1024 NAME Triam_Stairs2 ) 
	VecPoints( m 0
		   38   81    18  16238  22973  16799 ;  0
		   38   13    28  12539      0  30272 ;  1
		  -37   13    28 -12539      0  30272 ;  2
... and all the rest for this object
TransformEnd
Return
EndObj

In order to place the objects one way to go is to use SCASM macros. Here is a typical macro call:

Code:
Header( 1  41  39 -9 -11 )
LatRange(  39  41 )

; TriamStairs1
macro( "C:\Programas\SBuilderX\API\TRIAMSTAIRS1.API" 39.96978758 -9.87451072 50 .1 0.000 0 0 0 0 0 0.000 2 v2= 0 )

The macro file called TRIAMSTAIRS1.API can be seen here where you see the GUID that appears in the first model of the library excerpt that I presented above:

Code:
;CATEGORY Vehicle Objects
;MACRODESC TriamStairs1
;DEFAULTSCALE 0,10
;DEFAULTRANGE 50000 M
;DEFAULTDENSITY DENSE
;DESIGNSHAPELINES -10, -20, 10, -20, 10, -20, 10, 20, 10, 20, -10, 20, 

;   %1  Latitude
;   %2  Longitude
;   %3  Range 
;   %4  Scale
;   %5  Heading
;   %6  User
;   %7  User 
;   %8  User
;   %9  Shadow
;  %10  V1 value
;  %11  Elevation
;  %12  Scenery complexity

Area( 5 %1 %2 %3 )

	IfVarRange( :next@ 346  %12  5 )  ;check complexity

mif( %9 )
	ShadowCall( :scall@ )
mifend

	PerspectiveCall( :pcall@ )
	Jump( :next@ )

:pcall@

	Perspective

:scall@

mif( %11 )
	RefPoint(  ns  :ret@  %1 %2  v1= %10  E= %11  v2= 50   )
	SetScaleX( :ret@ 0 0 10 )
melse
	RefPoint(  rel  :ret@  1  %1 %2  v1= %10  v2= 50   )
	SetScaleX( :ret@ 0 0 10 )
mifend

mif( %5 )
	RotatedCall( :start@ 0 0 %5 )
melse
	Call( :start@ )
mifend
	Return

:start@
	CallLibObj(0 5469BA99 267300F0 022E0DB1 C0F65F5C )
:ret@
	Return

:next@

EndA

If you do not need macros (for example if you are not using the models again and again) you could write a minimum source file like (hope this right):

Header( )
LatRange( )
Area()
PerspectiveCall( :here )
Jump( : )
:here
RefPoint()
CallLibObj(0 5469BA99 267300F0 022E0DB1 C0F65F5C )
Return
EndA

Finally: I do not know if it is possible to combine the model and the placement in a single BGL. I always used separate files. One for the library with several objects and then separate BGLs with the calling commands.

Regards,

Luis
 
Hi,

Which FS versions will you be using them on, also FS2002?

If you want to use them in FS2004 or FSX it might be worthwhile to look at my ModelConverterX tool and convert the objects to MDL files that match these versions. For FS2002 there are no scenery MDL files, so you would have to compile them from a API into a BGL.
 
Luis,

Thank you for the number of example scripts. It will take some experimenting or studying before I can get the hang of such manual work..

Arno's approach of converting the SCA file to a FS9/FSX MDL file is a bit more "user-friendly" for me, though.

Arno, I was able to convert one .SCA file successfully, however the next two that I tried gave me the following errors:

Code:
8:34 PM	SCASMReader	Information	Starting reading of file C:\Documents and Settings\Kobbe Farwick\My Documents\xx
8:34 PM	BGLReader	Warning	Unknown BGL opcode 0
8:34 PM	SCASMReader	Information	Starting reading of subobject 0
8:34 PM	SCASMReader	Warning	Unsupported command Header in line 5
8:34 PM	SCASMReader	Warning	Unsupported command LatRange in line 6
8:34 PM	SCASMReader	Warning	Unsupported command IfVarRange3 in line 44
8:34 PM	SCASMReader	Warning	Unsupported command SetVar in line 45
8:34 PM	SCASMReader	Warning	This is an empty object!
8:34 PM	SCASMReader	Information	Finished reading of subobject 0
8:34 PM	SCASMReader	Information	Finished reading objects

Code:
An error occured during importing the selected file

Message:
The given key was not present in the dictionary.

StackTrace:
   at System.ThrowHelper.ThrowKeyNotFoundException()
   at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
   at ModelConverterX.SCASMReader.generate3DModel(List`1 cmdList, Dictionary`2 labelDict)
   at ModelConverterX.SCASMReader.Read(String filename)
   at ModelConverterX.ObjectReader.read(String fileName)
   at ModelConverterX.MainWindow.bwImporter_DoWork(Object sender, DoWorkEventArgs e)

Thanks again
 
Hi,

Can you send me the file that causes the error for debugging? It looks like you found a new bug in the tool :).
 
Why do I always have to be the one to find the bugs and glitches? :p

Tried attaching the files but they are too large. Can I email them to you?
 
Sure, please email them to me arno _AT_ fsdeveloper _DOT_ com
 
Back
Top