Document - HiStructClient/femcad-doc GitHub Wiki

A document is a method of output. Document is used to generate technical reports etc. Document is composed of multiple children.

A simple example of a document with 2 children:

SimpleDocument := Fcs.Reporting.Document{
   TitleBlock := Fcs.Reporting.Paragraph ( rw => "This is TitleBlock."),
   DefaultSetup := Fcs.Reporting.Setup{
      GenerateTableOfContent  := False,
      Numbered := False,
      Collapsible := True,
      },
   Collapsed := True,
   #...
   Children := [
      chapterChild,
      tableChild
   ]
}

chapterChild := Fcs.Reporting.Chapter{
   Title := "I am chapterChild's title.",
   Children :=[
      FCS.Reporting.Paragraph{
      TextFn = rw => "I am the first paragraph."
      }
    ]
}
tableChild := Fcs.Reporting.Table{
   Title := "I am tableChild's title.",
   Header := Fcs.Reporting.Table.Row("Column 1 Heading", "Column 2 Heading", "Column 3 Heading"),
   Body := [Fcs.Reporting.Table.Row([ Fcs.Reporting.Paragraph(rw => "Data 1"), Fcs.Reporting.Text( "sloupec2"), Fcs.Reporting.Text( "sloupec3")] )]
}

Be aware that Body element in table must be an array of rows.

Settings of the document can be changed in DefaultSetup parameter:

EngineeringReportDocument := Fcs.Reporting.Document{
   DefaultSetup := Fcs.Reporting.Setup{
      GenerateTableOfContent  := True,
      Numbered := False,
      Collapsible := True,
      Units := unitSetup
      },
   Collapsed    := False,
   Title    := "Engineering report: ",
   Children := ( [
      ... ]
   ) } 

where unitSetup is defined as:

unitSetup := ( Fcs.Units.Setup( Fcs.Units.DefaultSteel, CustomMapOfUnits, customMapOfFormats ) ){}

CustomMapOfUnits:= [
   [ Fcs.EngineeringQuantity.Length            ,Unit.mm    ],
   [ Fcs.EngineeringQuantity.BeamInternalForce ,Unit.kN    ],
   [ Fcs.EngineeringQuantity.Force             ,Unit.kN    ],
   [ Fcs.EngineeringQuantity.LoadForcePerArea  ,Unit.kN_m2 ],
   [ Fcs.EngineeringQuantity.BeamBendingMoment ,Unit.kNm   ],
   [ FCS.EngineeringQuantity.Mass              ,Unit.kg    ],
   [ Fcs.EngineeringQuantity.Stress            ,Unit.MPa   ],
   [ Fcs.EngineeringQuantity.Displacement      ,Unit.mm    ],
   [ Fcs.EngineeringQuantity.MaterialStrength  ,Unit.MPa   ],
]
customMapOfFormats := res.doc{
      unitCheckUnitFormat := "0.00",
      lengthFormat:= "# ### ##0"
   }.CustomMapOfFormats

Images

For inserting an image to document use InTextPictureClass.fcs:

myImage := res.doc.InTextPicture{
   path        := "..\customPathToFile\",
   file        := "fileName.jpg", 
   imgHtmlProp := "style='text-align: left; width:300px;'",
   divHtmlProp := "style='text-align: left; width:300px;'" 
   }.PictureInChapter  # ---> or .PictureBlock can be used.

For inserting an image generated by FemCad use ImageRender:

ImageRender := Fcs.Presentation.ImageRenderer{
   Model := model.Fcm,        # model is a gclass of the printed object
   DrawSettingsFile       := plech.Fcm.GetFileNamePath("CollarCover_Assy.fcsdrs"),      
   ProjectionSettingsFile := plech.Fcm.GetFileNamePath("CollarCover_Assy.fcsdrv"), 
       # .fcsdrs and .fcsdrv files can be saved in FemCad
   AutoZoom := True },

Image := Fcs.Reporting.Image {
   ImageContent := ImageRender,
   Title := "Image title"
}

Image created with ImageRender can be further eddited by changing parameters in .fcsdrv file. For better orientation in the chaotic parameters (text) in .fcsdrv generated by FemCad, open the file in Visual Studio Code and select Format Document in right-click menu. Parameters that are most worthy of attention are: "autoFit": true, "sizeAutoToScreen": true, "xSize": xx, "ySize": xx, "mShiftView": { "x": -xx, "y": xx }.

Outputting the user-defined input values

Every InputPage based on res.fit.FitInputItem class has a document defined, so if you stick to the regular recomendations for assembling the input pages (see How to define Input), you shouldnt have problems with generating the output document - just call the Document variable in re.fit.FitInputItem class. For example:

InputPageBuilding := res.fit.InputItemClass{
    NameSpace    := NameSpace + "InputPageBuilding.",
    HumanName    := "Page building",
    ClassItems   := [
	BuildingAplication,
	BuildingGeometry,
		] }

BuildingApplication := res.fit.InputItemList{
   NameSpace   := NameSpace + "BuildingApplication.",
   HumanName   := "Building application",
   Identifier  := "input.inBuildingApplicationId",
   Key         := input.inBuildingApplicationId,
   ListOptions := [ 
   [ "Other"                 , 100 ], # all options
   [ "Poultry - Broiler"     , 101 ],
   [ "Poultry - Breeder"     , 102 ], 
   [ "Poultry - Cages"       , 103 ], 
   [ "Poultry - Cage free"   , 104 ], 
   [ "Poultry - Layer floor" , 105 ], 
] }

BuildingGeometry := res.fit.InputItemClass{ 
   NameSpace  := NameSpace + "BuildingGeometry.",
   HumanName  := "Building geometry",
   ClassItems := [
       BuildingWidth,
           BuildingLength,
       ] }	
BuildingWidth := res.fit.InputItemDouble{
   NameSpace   := NameSpace + "BuildingWidth.",
   HumanName   := "Building width (inside)",
       Description := "Building width measured from inside to inside of columns",
   UnitString := "m",
   Max := 50,
   Identifier := "input.inBuildingWidth",
   Value := input.inBuildingWidth}

The value outputted in document should be passed to FitInputItem in parameters:

  • Value (for double and integer),
    
  • ValueString (for String),
    
  • Key (for InputItemList).
    

Preview of final HTML

It is possible to use following expression to see the HTML code which will be generated.

  • FCS.Reporting.RenderHtml(nameOfDocument,FCS.Reporting.Setup{Units=FCS.Units.DefaultFEM})

Bootstrap icons in Document

Every FemCad html document includes Bootstrap, so its easy to use colored icons. To insert any icon, put bootstrap string into document:

<span class="glyphicon glyphicon-ok" style="color:green"></span>
<span class="glyphicon glyphicon-remove" style="color:red"></span>

There is a function in _Common/FcsDocument/FcsDocTools.fcs (in Deve-TB branch, fcs-HBC), which assembles this string.

getBootstrapIconFn := iconNameStr, colorStr => ( "<span class=" + quoteString + BootstrapIcons.glyphiconString + 
    BootstrapIcons.getIconStringFn(iconNameStr) + quoteString +
   "style=" + quoteString + "color:" + colorStr + quoteString + "></span>" )

The list of all bootstrap icons can be found here: https://www.w3schools.com/bootstrap/bootstrap_ref_comp_glyphs.asp

⚠️ **GitHub.com Fallback** ⚠️