Little update to the code to speed it up if there's more sketches in there. Anyway, what do you need the perimeter for?
The flat pattern is always in the first quadrant. It start's at X = 0, Y = 0 and both goes to positive numbers.
So, you can simply use (0;0) as origin and width and heigth as maximal boundary.
Anyway if you "have" to have the region, you can use this:
<Querying a sketch profile to get regions>

Dim oDoc As Document = ThisApplication.ActiveDocument
If oDoc.DocumentSubType.DocumentSubTypeID <> "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then Exit Sub
Dim oCD As SheetMetalComponentDefinition = oDoc.ComponentDefinition
If Not oCD.HasFlatPattern() Then
oCD.Unfold()
Else
oCD.FlatPattern.Edit()
End If
Dim oFP As FlatPattern = oCD.FlatPattern
Dim oFace As Face = oFP.TopFace
Dim oSketches As PlanarSketches = oFP.Sketches
Try
oSketches("MySuperSketch").Delete()
Catch
End Try
Dim oSketch As PlanarSketch = oSketches.Add(oFace, True)
oSketch.Name = "MySuperSketch"
oSketch.Edit()
Dim oProfile As Profile = oSketch.Profiles.AddForSolid
Dim oRegion As RegionProperties = oProfile.RegionProperties
Dim oPerimeter As Double = oRegion.Perimeter
oSketch.ExitEdit()
oFP.ExitEdit()
Consider using "Accept as Solution" / "Kudos" if you find this helpful.
- - - - - - - - - - - - - - -
Regards,
Mike
"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." - John F. Woods