Pythagoras VBA Manual
Pythagoras VBA Manual
Pythagoras VBA Manual
Table of Contents
Table of Contents Chapter 1 Introduction How to read this manual? General Remarks Pythagoras VBA 1. Main differences between Microsoft VBA and Pythagoras VBA 2. The Pythagoras Object Model 3. Pythagoras Macro Libraries 4. Access to Protected and Invisible objects Getting started Exporting and importing VBA Sources and Forms 1. Export VBA Sources and Forms 2. Import VBA Sources and Forms Events 1. Calling Event macros 2. Type of events Private Tools Chapter 2 Application Properties GetPrivateTools PrivateToolMenuEnabled PrivateToolMenuString PrivateToolSelected PrivateToolCursor PrivateToolSnapping PrivateToolTargetEnabled PrivateToolTargetType PrivateToolTargetPosition LicenceNumber Language Version VersionStr ApplicationDirectory UserProfileDirectory PublicDirectory TemporaryDirectory PythagorasLocalDirectory CodeDescriptionFile HiliteSelections SystemClipboard SystemDate AreaAnnotationFormat SystemParameters IgnoreDataErrors NilUUID NegativeInfinity PositiveInfinity NaN Methods NewToolbarButton RemoveToolbarButtons i 1-1 1-1 1-1 1-1 1-1 1-1 1-2 1-2 1-3 1-3 1-5 1-5 1-6 1-6 1-6 1-6 1-7 2-1 2-3 2-3 2-3 2-4 2-4 2-4 2-4 2-5 2-5 2-5 2-6 2-6 2-6 2-6 2-7 2-7 2-7 2-7 2-8 2-8 2-8 2-8 2-9 2-9 2-9 2-9 2-10 2-10 2-10 2-10 2-11 2-11 2-11
EnableToolbarButton NewUserMenu RemoveUserMenu AppendUserMenuItem AppendUserPopupMenuItem AppendUserSubMenuItem RemoveUserMenuItem RemoveUserSubMenuItem EnableUserMenuItem CheckUserMenuItem OpenDocument GetNewDocument PutDocumentOnTop GetActiveDocument Wait ContinueEvent StopEvent SetEventKeys GetEventKeys ConvertImage GetDocuments GetSymbolLibrary GetCoordinateReferenceSystems GetTiePointsSetCollection GetDialogs TileWindows CascadeWindows AddToRecentFiles OpenExternalFile DownloadFile GetPathName GetFileName Intersection2Lines Intersection BestLine BestArc BestCircle ProjectionOnLine OptionSupported ColumnValue SelectCondition NameCategory RowSetDefinition MatchCondition WhereCondition ColumnDefinition CreateUUID IsNilUUID EqualUUID UUIDToString StringToUUID UUIDToDate Parse TrueColorToColor ColorToTrueColor GetUserDefaults
2-11 2-11 2-12 2-12 2-12 2-13 2-13 2-13 2-14 2-14 2-14 2-15 2-15 2-15 2-15 2-15 2-16 2-17 2-17 2-17 2-18 2-18 2-19 2-19 2-19 2-19 2-20 2-20 2-20 2-20 2-21 2-21 2-21 2-22 2-22 2-22 2-22 2-23 2-23 2-23 2-24 2-24 2-24 2-24 2-25 2-25 2-25 2-26 2-26 2-26 2-27 2-27 2-27 2-28 2-28 2-28
GetAttributesSet SetVBADefaultAttributes UTF8ToASCII UTF8ToASCIIV ASCIIToUTF8 IsNegativeInfinity IsPositiveInfinity IsInfinity IsNaN SortAll Sort SortValueIndex IncPointIdent InitSelectionCriteria DebugInput DebugOutput XML Methods CreateXMLDocument ReadXMLDocument GetXMLErrorPosition XMLReplaceWhites XMLCollapseWhites XMLWhiteSpaceNormalize XMLStringToBoolean XMLStringToInteger XMLDecimalStringToReal XMLStringToReal XMLStringToDateTime XMLStringToTime XMLStringToDate XMLStringToUTCDateTime XMLStringToUTCTime XMLDivideString XMLStringToBooleans XMLStringToIntegers XMLDecimalStringToReals XMLStringToReals XMLStringToDateTimesZ XMLStringToTimesZ XMLStringToDatesZ XMLStringToDateTimes XMLStringToDates XMLStringToTimes XMLStringToUTCDateTimes XMLStringToUTCTimes XMLBooleanToString XMLIntegerToString XMLRealToDecimalString XMLRealToString XMLDateTimeToString XMLTimeToString XMLDateToString XMLUTCDateTimeToString XMLUTCTimeToString XMLUniteStrings XMLBooleansToString
2-29 2-29 2-29 2-30 2-30 2-30 2-31 2-31 2-31 2-31 2-32 2-32 2-33 2-33 2-33 2-34 2-34 2-34 2-37 2-37 2-38 2-38 2-38 2-38 2-39 2-39 2-39 2-39 2-40 2-40 2-40 2-41 2-41 2-41 2-42 2-42 2-42 2-42 2-43 2-43 2-43 2-44 2-44 2-44 2-44 2-44 2-45 2-45 2-45 2-46 2-46 2-46 2-46 2-47 2-47 2-47
XMLIntegersToString XMLRealsToDecimalString XMLRealsToString XMLDateTimesToString and XMLTimesToString XMLTimesToString XMLDatesToString XMLUTCDateTimesToString XMLUTCTimesToString XMLValidName Chapter 3 PrivateTool Properties Active Default Tooltip MenuEnabled MenuString Snapping TargetEnabled TargetType TargetPosition Cursor OnPrivateTool, OnMouseMove, OnMouseDown, OnMouseUp, OnMouseDoubleClick, OnRightMouseDown, OnRightMouseUp, OnRightMouseDoubleClick, OnMiddleMouseDown, OnMiddleMouseUp, OnMiddleMouseDoubleClick Chapter 4 PrivateTools Methods GetFirst GetNext GetActivePrivateTool SetPrivateToolActive AddPrivateTool RemovePrivateTool Chapter 5 Document Properties ReadOnly NewGroupId Name SnappedObjectPosition EventCursorPosInDoc EventCursorPosInWindow Info Extent FolderExternalFile ActiveOverlay Scale ZoomFactor ActiveSheet Database LockedDatabase, DifferentDatabaseLocks, NrOfTables, NrOfAttributeTables, NrOfDictionaryTables, NrOfViews NextPointIdent Methods Save SaveAs CloseDoc
2-47 2-48 2-48 2-48 2-48 2-49 2-49 2-49 2-49 3-1 3-1 3-1 3-2 3-2 3-2 3-2 3-3 3-3 3-3 3-4 3-4 3-4 4-1 4-1 4-1 4-1 4-2 4-2 4-2 4-3 5-1 5-2 5-2 5-2 5-3 5-3 5-3 5-4 5-4 5-4 5-5 5-5 5-5 5-5 5-6 5-6 5-6 5-6 5-7 5-7 5-7 5-7
NewState 5-8 EndState 5-8 ClearUndo 5-9 UpdateScreen 5-9 RedrawDocument 5-9 GetOverlay 5-10 GetSelection 5-10 GetFlaggedObjects 5-10 GetObjectUnderCursor 5-10 ObjectReferenceToCadObject 5-11 GetKeyboardEventData 5-11 Paste 5-12 ImportShape 5-13 ImportShapeRegion 5-13 ImportDWG (ImportDXF) 5-14 ImportDataCollector 5-14 GetActiveCoordinateSystem 5-15 GetCoordinateReferenceSystem 5-15 SetCoordinateReferenceSystem 5-15 TransformXYTo 5-16 TransformXYFrom 5-16 TransformPossible 5-17 Center 5-17 Zoom 5-17 ZoomRectangle 5-18 FitInWindow 5-18 ShowAll 5-18 GetLayers 5-19 GetLayerGroups 5-19 GetSymbolLibrary 5-19 GetWindow 5-20 GetTerrainModels 5-20 GetSubDocuments 5-21 GetTiePointsSetCollection 5-21 FirstTable, NextTable, TableByName, CreateTable, ImportDFB, DropTable, CopyTableSkeleton, CopyTable, FirstDBView, NextDBView, DBViewByName, CreateSimpleQuery, CreateAggregationQuery, DropQuery, CopyQuery, CopyDatabaseSkeleton, CopyDatabase, PurgeDatabase, DropDatabase, LockDatabase, UnlockDatabase, ActualizeQueries 5-21 GetThematicMaps 5-21 GetViews 5-22 PointIdentUsed 5-22 Chapter 6 Documents Properties NrOfDocuments Methods GetFirst GetNext Chapter 7 SubDocument Properties Name Active Main Status NameRelative DifferentDatabaseLock 6-1 6-1 6-1 6-1 6-1 6-1 7-1 7-1 7-1 7-1 7-1 7-2 7-2 7-2
Methods GetDocument Chapter 8 SubDocuments Properties NrOfSubDocuments Methods GetFirst GetNext AddSubDocument RemoveSubDocument GetMain GetActive SetActive GetDocument Chapter 9 Properties Name Active Visible View
7-2 7-2 8-1 8-1 8-1 8-1 8-1 8-1 8-2 8-2 8-2 8-3 8-3 8-3 9-1 9-1 9-1 9-1 9-1 10-1 10-1 10-1 10-1 10-1 10-2 10-2 10-2 10-3 11-1 11-1 11-1 11-1 12-1 12-1 12-1 12-1 12-1 12-2 13-1 13-1 13-1 13-1 13-2 13-2 13-2 13-3 13-3 13-3 13-4 13-4 13-4 13-4 13-5
Chapter 10 Views Properties NrOfViews Methods GetFirst GetNext GetView GetActive SetActive Chapter 11 Properties Name Active ThematicMap
Chapter 12 ThematicMaps Properties NrOfThematicMaps Methods GetFirst GetNext Chapter 13 Sheet Properties Name Active PaperWidth PaperHeight Margins ScaleFactor Scale Position PageAngle Floating Methods GetAllObjects CreatePoint
CreateLine CreateArc CreateCircle CreateText CreateRichText CreateClothoid CreateHorizontalCurve CreateCurve CreatePolygon CreatePath CreateImage InsertImage CreateCompound Duplicate PrintOut SetPrintArea ClearPrintArea Chapter 14 Sheets Properties NrOfSheets Methods GetFirst GetNext GetSheet GetActive SetActive Chapter 15 Overlay Properties Methods CreatePoint CreateLine CreateArc CreateCircle CreateText CreateRichText CreateClothoid CreateHorizontalCurve CreateCurve CreatePolygon CreatePath CreateImage InsertImage CreateCompound GetAllObjects GetCoordinateSystems CreateTempCoordinateSystem CreateUserCoordinateSystem Clip XYToPoint Chapter 16 CadObject Properties ObjectType Comment Link URL_Link
13-5 13-5 13-5 13-6 13-6 13-6 13-6 13-7 13-7 13-7 13-7 13-8 13-8 13-8 13-8 13-9 13-9 14-1 14-1 14-1 14-1 14-1 14-2 14-2 14-2 14-3 15-1 15-1 15-1 15-1 15-2 15-2 15-3 15-3 15-4 15-4 15-5 15-5 15-6 15-7 15-7 15-7 15-8 15-8 15-9 15-9 15-10 15-10 15-10 16-1 16-2 16-2 16-2 16-2 16-3
Color TrueColor DisplayLevel GroupId Container Layer Overlay CanBeDeleted CanChangeOverlay ObjectReference Selected Flagged Data GetQueryData Sheet Methods GetPoint GetLine GetArc GetCircle GetClothoid GetCurve GetText GetRichText GetPolygon GetImage GetPath GetCoordinateSystem GetCompound GetDocument GetSubDocument GetReferencingObjects SetData DeleteData ConvertToPolyline SetLink Chapter 17 Point Properties PointIdent Coordinates Elevation ZoomFactor PointStyle Methods GetCadObject GetOrientation SetOrientation GetScaleFactor SetScaleFactor Chapter 18 Properties LineStyle Scale Width Arrows Line
16-3 16-3 16-3 16-3 16-4 16-4 16-4 16-5 16-5 16-5 16-5 16-6 16-6 16-6 16-6 16-7 16-7 16-7 16-7 16-7 16-8 16-8 16-8 16-8 16-8 16-9 16-9 16-9 16-9 16-10 16-10 16-10 16-10 16-11 16-11 16-11 17-1 17-1 17-1 17-2 17-2 17-2 17-2 17-3 17-3 17-3 17-3 17-3 17-4 18-1 18-1 18-2 18-2 18-2 18-2
LineLength Bearing DeltaZ SlopeLength Methods GetCadObject GetBeginPoint GetEndPoint CDZtoXYZ XYZtoCDZ Chapter 19 Arc Properties ArcLength Radius DeltaZ SlopeLength ArcAperture Center Methods GetCadObject GetBeginPoint GetEndPoint CDZtoXYZ XYZtoCDZ Chapter 20 Circle Properties Radius Center RadiusPnt Methods GetCadObject Chapter 21 Curve Properties NrOfPoints Curvature MaxRounding ThreeD Elevation StartTangent EndTangent Methods GetCadObject GetCurvePoints Chapter 22 Clothoid Properties Length DeltaZ SlopeLength K (or ClothoidConstant) StartRadius EndRadius Mirrored StartCenter EndCenter
18-2 18-3 18-3 18-3 18-3 18-3 18-4 18-4 18-4 18-4 19-1 19-1 19-1 19-2 19-2 19-2 19-2 19-2 19-3 19-3 19-3 19-3 19-3 19-4 20-1 20-1 20-1 20-1 20-2 20-2 20-2 21-1 21-1 21-1 21-2 21-2 21-2 21-2 21-2 21-3 21-3 21-3 21-3 22-1 22-1 22-1 22-2 22-2 22-2 22-2 22-2 22-3 22-3 22-3
Methods GetCadObject GetBeginPoint GetEndPoint CDZtoXYZ XYZtoCDZ Chapter 23 Text Properties Position Content Orientation Angle Style Weight PointSize HorizontalAlignment VerticalAlignment Underline Border LineSpacing Opaque Methods GetCadObject GetAngle GetContent GetFont SetFont Chapter 24 RichText Properties Position Content Orientation Angle HorizontalAlignment VerticalAlignment Opaque Border Methods GetCadObject GetAngle Chapter 25 Path Properties NrOfObjects TotalLength TotalSlopeLength DeltaZ StartingChainage Methods GetCadObject GetPathObjects CDZtoXYZ XYZtoCDZ Chapter 26 Properties Road
22-3 22-4 22-4 22-4 22-4 22-4 23-1 23-1 23-1 23-2 23-2 23-2 23-2 23-3 23-3 23-3 23-3 23-4 23-4 23-4 23-4 23-4 23-5 23-5 23-5 23-5 23-6 1 1 1 1 24-1 24-1 24-1 24-1 24-1 24-1 24-1 24-1 24-1 25-1 25-1 25-1 25-1 25-2 25-2 25-2 25-2 25-2 25-3 25-3 25-4 26-1 26-1
Color TotalLength StartingChainage Methods GetCadObject GetColor SetColor GetProfileData GetHorizontalAlignmentData GetSuperElevationData GetRD_CrossSectionPositions GetRD_ReferenceObjects GetCenterLine CDZtoXYZ XYZtoCDZ Chapter 27 Polygon Properties NrOfObjects Pattern Border Opaque BackgroundColor BackgroundPattern Scale Area Perimeter TotalSlopeLength Centroid Methods GetCadObject GetPolygonObjects AlignPolygon GetPolygonAlignment PointInsidePolygon Chapter 28 Image Properties Monochrome ColorDepth Width & Height DPMx & DPMy WidthInPixels & HeightInPixels Position FileName NameRelative Intensity Inverted Transparent Methods GetCadObject SetReduce_Enlarge GetReduce_Enlarge SetScale GetScale GetOrientation SetOrientation
26-1 26-2 26-2 26-2 26-2 26-2 26-3 26-3 26-3 26-4 26-4 26-5 26-5 26-6 26-7 27-1 27-1 27-1 27-2 27-2 27-2 27-2 27-3 27-3 27-3 27-3 27-3 27-4 27-4 27-4 27-4 27-5 27-5 27-5 28-1 28-1 28-2 28-2 28-2 28-2 28-2 28-3 28-3 28-3 28-3 28-4 28-4 28-4 28-4 28-4 28-5 28-5 28-5 28-5 28-6
PixelRect PositionRect ImageData ImageDataSize Chapter 29 Compound Properties NrOfElements Methods GetElements Chapter 30 CoordinateSystem Properties Overlay TypeOfCS Name Origin ZOfOrigin XAxisPnt YAxisPnt TransformationParameters Methods SetActive Chapter 31 CoordinateSystems Properties NrOfCoordinateSystems Methods GetFirst GetNext Chapter 32 CoordinateReferenceSystem Properties Name LocalName ShortName CRSType Methods TransformXYTo TransformToPossible Chapter 33 CoordinateReferenceSystems Properties NrOfCoordinateReferenceSystems Methods GetFirst GetNext GetCoordinateReferenceSystem Chapter 34 TiePointsSetCollection Properties Count Methods GetFirst GetNext GetTiePointsSet Chapter 35 Properties Name TiePointsSet
28-6 28-6 28-6 28-7 29-1 29-1 29-1 29-2 29-2 30-1 30-1 30-1 30-1 30-2 30-2 30-2 30-2 30-2 30-3 30-3 30-3 31-1 31-1 31-1 31-1 31-1 31-1 32-1 32-1 32-1 32-1 32-1 32-2 32-2 32-2 32-2 33-1 33-1 33-1 33-1 33-1 33-1 33-2 34-1 34-1 34-1 34-1 34-1 34-1 34-2 35-1 35-1 35-1
NrOfElements CRSFrom CRSTo Methods GetFirstElement GetNextElement Chapter 36 Selection, FlaggedObjects, AllObjects Properties Overlay Sheet Wallpaper NrOfObjects NrOfWholeObjects Color TrueColor ImageIntensity Comment DisplayLevel Layer PointStyle LineStyle LineWidth LineArrows TextStyle TextWeight TextPointSize TextHorizontalAlignment TextVerticalAlignment TextUnderline TextBorder TextLineSpacing TextOpaque TextOrientation TextAngle CurveCurvature CurveMaxRounding PolygonPattern PolygonBorder PolygonOpaque PolygonBackgroundColor PolygonBackgroundPattern CanChangeOverlay Container Methods Count GetFirst GetNext ChangeOverlay Copy Cut Clear Move Rotate Group Ungroup Unpack
35-1 35-1 35-2 35-2 35-2 35-2 36-1 36-2 36-2 36-3 36-3 36-3 36-3 36-4 36-4 36-4 36-5 36-5 36-5 36-5 36-6 36-6 36-6 36-7 36-7 36-7 36-8 36-8 36-8 36-9 36-9 36-9 36-10 36-10 36-10 36-11 36-11 36-11 36-12 36-12 36-12 36-12 36-12 36-13 36-13 36-14 36-14 36-14 36-15 36-15 36-15 36-15 36-16 36-16 36-16 36-17
DeleteData AddAnnotation AdjustDisplayLevel SetZ ScalePoints ScaleLines ScaleTexts ScalePolygons AlignPolygons ConvertObjectsToPolylines GetFirstPoint GetNextPoint IntersectingLines Intersections UnderShoot OverShoot SetTextFont Transform ClearSet MakeSet MakeSetDB MakeSetTextual Toggle Include Exclude InSet ApplyThematics GetThematics RemoveThematics ExportShape GetTerrainModel Chapter 37 TerrainModel Properties Name zMin zMax NrOfTriangles NrOfVertexes EnclosingRectangle Methods Elevation AdjustElevationOfVertex AdjustAllElevations Slope GetTriangle GetFirstTriangle GetNextTriangle GetFirstVertex GetNextVertex CrossSection CrossSectionPnts Duplicate AddVertex RemoveVertex MoveVertex AddTriangle
36-17 36-17 36-18 36-18 36-18 36-18 36-19 36-19 36-19 36-19 36-19 36-20 36-20 36-21 36-21 36-21 36-22 36-22 36-22 36-22 36-23 36-24 36-24 36-24 36-25 36-25 36-25 36-26 36-26 36-26 36-27 37-1 37-2 37-2 37-2 37-2 37-2 37-2 37-3 37-3 37-3 37-3 37-3 37-4 37-4 37-4 37-4 37-5 37-5 37-5 37-6 37-6 37-7 37-7 37-7 37-7
RemoveTriangle SwapDiagonal Chapter 38 TerrainModels Properties NrOfTerrainModels Methods GetFirst GetNext FindTerrainModel NewTerrainModel DeleteTerrainModel SetActive GetActive Chapter 39 Methods Adjacent Vertexes Triangle
37-8 37-8 38-1 38-1 38-1 38-1 38-1 38-1 38-2 38-2 38-2 38-3 38-3 39-1 39-1 39-1 39-1 40-1 40-1 40-1 40-2 40-2 40-2 40-2 40-3 40-3 40-3 40-3 40-3 40-4 40-4 40-4 40-5 40-5 40-6 40-6 40-6 40-7 40-7 40-8 40-8 40-8 40-9 40-9 40-9 40-10 40-10 40-10 40-11 40-11 40-11 40-12 41-1 41-2
Chapter 40 Database Properties Document LockedDatabase DifferentDatabaseLocks NrOfTables NrOfAttributeTables NrOfDictionaryTables NrOfDBViews Methods FirstTable NextTable TableByName CreateTable ImportDBF DropTable CopyTableSkeleton CopyTable FirstDBView NextDBView DBViewByName CreateSimpleQuery CreateAggregationQuery DropQuery CopyQuery CopyDatabaseSkeleton CopyDatabase PurgeDatabase DropDatabase CloseDatabase NewState EndState LockDatabase UnlockDatabase ActualizeQueries Chapter 41 Properties DBTable
Document Name Description TableType ObjectTypes Access NrOfColumns NrOfRows DataStamp Methods Identical GetColumn AddColumn DropColumn InsertRow FirstRow NextRow LastRow PreviousRow GetRows RowById DeleteRow FirstSubDocument NextSubDocument GetSubDocuments Clear FastClear CopyData Chapter 42 DBTableColumn Properties Table SeqOrder Name Description DataType ObjectTypes Display MayBeNull Changeable Minimum Maximum Default Fractional ReferencedColumn PendingAction Indexed Unique Format Methods Move GetRow GetRows Chapter 43 Properties Database DBQuery
41-2 41-2 41-3 41-3 41-3 41-3 41-4 41-4 41-4 41-5 41-5 41-5 41-5 41-6 41-6 41-7 41-7 41-7 41-8 41-8 41-9 41-9 41-9 41-9 41-10 41-10 41-10 41-10 42-1 42-1 42-1 42-1 42-1 42-2 42-2 42-2 42-3 42-3 42-3 42-3 42-4 42-4 42-4 42-4 42-5 42-5 42-5 42-5 42-6 42-6 42-6 42-6 43-1 43-1 43-1
QueryType MainBaseDefinition, AuxBaseDefinition Name Description Where Preferences Match Validity ErrorIndex SyntaxError ErrorStart, ErrorEnd NrOfWhereConditions NrOfColumns CadObjectLinked ObjectTypes Overlay Sheet Methods GetWhere AddWhere AlterWhere MoveWhere DropWhere AddColumn GetColumn DropColumn GetRows RowById Chapter 44 Properties Query SeqOrder Definition DataType Methods Move DBQueryColumn
43-2 43-2 43-2 43-2 43-2 43-3 43-3 43-3 43-5 43-6 43-6 43-6 43-6 43-6 43-7 43-7 43-7 43-7 43-7 43-8 43-8 43-9 43-9 43-9 43-9 43-10 43-10 43-10 44-1 44-1 44-1 44-1 44-1 44-2 44-2 44-2 45-1 45-1 45-1 45-1 45-1 45-2 45-2 45-2 45-2 45-2 45-3 45-3 45-3 45-3 45-4 46-1 46-1 46-1 46-1
Chapter 45 DBRow Properties Table Query LinkedObject Id Overlay Sheet Methods GetAll GetValue SetValue GetStringValue Update Identical Chapter 46 Properties Table Query DBRows
Subdocument ByColumn Methods FirstRow NextRow LastRow PreviousRow Chapter 47 DBSubDocuments Properties Table NrOfSubDocuments Methods FirstSubDocument FirstSubDocument Chapter 48 Layer Properties Name Protected Visible Wallpaper MinimumScale MaximumScale CanBeDeleted Methods SetMinimumAndMaximumScale Chapter 49 Layers Properties NrOfLayers Protected Visible Wallpaper Methods GetFirst GetNext GetActiveLayer SetActiveLayer GetLayer NewLayer DeleteLayer DeleteEmptyLayers SetProtected, SetVisible, SetSnappingDisabled Chapter 50 LayerGroup Properties Name NrOfLayers Methods GetFirst GetNext SetProtected SetVisible SetSnappingDisabled SetMinimumAndMaximumScale AddLayer RemoveLayer
46-1 46-2 46-2 46-2 46-2 46-3 46-3 47-1 47-1 47-1 47-1 47-1 47-1 47-2 48-1 48-1 48-1 48-1 48-2 48-2 48-2 48-2 48-2 48-3 48-3 49-1 49-1 49-1 49-1 49-1 49-2 49-2 49-2 49-2 49-2 49-3 49-3 49-3 49-3 49-4 49-4 50-1 50-1 50-1 50-2 50-2 50-2 50-2 50-2 50-2 50-3 50-3 50-3 50-3
Chapter 51 LayerGroups Properties NrOfGroups Methods GetFirst GetNext NewGroup DeleteGroup SetActive GetActive Chapter 52 Symbol Properties TypeOfSymbol Class Group Item FixedColor ScaleDependent CanBeRemoved Methods GetDocument GetPointSymbol GetLineSymbol GetPattern GetSectionSymbol Chapter 53 Properties Rotatable Limits Methods Chapter 54 Properties Width Length Methods Chapter 55 Properties Methods Chapter 56 Properties Methods PointSymbol
51-1 51-1 51-1 51-1 51-1 51-1 51-2 51-2 51-2 51-2 52-1 52-1 52-1 52-2 52-2 52-2 52-2 52-2 52-3 52-3 52-3 52-3 52-3 52-4 52-4 53-1 53-1 53-1 53-1 53-2 54-1 54-1 54-1 54-1 54-1 55-1 55-1 55-1 56-1 56-1 56-1 57-1 57-1 57-1 57-1 57-2 57-2 57-2 57-2 57-2 57-3 58-1 58-1
LineSymbol
Pattern
SectionSymbol
Chapter 57 SymbolGroup Properties TypeOfSymbol Class Group NrOfSymbols Methods GetDocument GetFirst GetNext Chapter 58 Properties Symbols
TypeOfSymbol Class NrOfSymbols NrOfGroups Methods GetDocument GetFirstSymbol GetNextSymbol GetSymbol GetFirstGroup GetNextGroup GetGroup RemoveAllUnusedSymbols Chapter 59 Library Properties Class Methods GetDocument GetPointSymbols GetLineSymbols GetPatterns GetSectionSymbols Add Remove CreateSymbol RemoveAllUnusedSymbols Chapter 60 SymbolContainer Methods AddLine AddColoredLine AddArc AddColoredArc AddCircle AddColoredCircle AddText AddColoredText AddPolygon AddColoredPolygon Chapter 61 UserDefaults Properties NrUserDefaults Methods GetFirst GetNext SetActive GetActive RemoveUserDefault AddUserDefault Chapter 62 UserDefault Properties Group Name Active AttributesSet
58-1 58-1 58-2 58-2 58-2 58-2 58-2 58-3 58-3 58-3 58-3 58-3 58-4 59-1 59-1 59-1 59-1 59-1 59-2 59-2 59-2 59-2 59-2 59-3 59-3 59-3 60-1 60-1 60-1 60-1 60-2 60-2 60-2 60-3 60-3 60-3 60-4 60-4 61-1 61-1 61-1 61-1 61-1 61-2 61-2 61-2 61-2 61-3 62-1 62-1 62-1 62-1 62-2 62-2
Methods GetFullName Chapter 63 AttributesSet Properties PointAttributes LineAttributes PolygonAttributes TextAttributes ImageAttributes TrueColor HasColor Layer HasLayer DisplayLevel HasDisplayLevel Comment HasComment PointConfirmation HasPointConfirmation Copy Chapter 64 PointAttributes Properties PointStyle HasStyle TrueColor HasColor Layer HasLayer DisplayLevel HasDisplayLevel Comment HasComment PointIdent HasPointIdent ZoomFactor HasZoomFactor HasScaleFactor Copy Methods GetScaleFactor SetScaleFactor Chapter 65 LineAttributes Properties LineStyle HasStyle TrueColor HasColor Layer HasLayer DisplayLevel HasDisplayLevel Comment HasComment HiddenEndPoints HasHiddenEndPoints
62-2 62-2 63-1 63-1 63-1 63-2 63-2 63-2 63-2 63-3 63-3 63-3 63-3 63-4 63-4 63-4 63-4 63-4 63-5 63-5 64-1 64-1 64-1 64-1 64-2 64-2 64-2 64-2 64-2 64-3 64-3 64-3 64-3 64-3 64-4 64-4 64-4 64-4 64-5 64-5 64-5 65-1 65-1 65-1 65-1 65-2 65-2 65-2 65-2 65-2 65-3 65-3 65-3 65-3 65-4
Arrows HasArrows Width HasWidth Scale HasScale Copy Chapter 66 PolygonAttributes Properties Pattern HasPattern Border HasBorder TrueColor HasColor Layer HasLayer DisplayLevel HasDisplayLevel Comment HasComment BGPattern BGColor HasBGPattern Scale HasScale Opaque HasOpaque Copy Chapter 67 TextAttributes Properties Content Style HasStyle PointSize HasPointSize Underline HasUnderline Border HasBorder Weight HasWeight LineSpacing HasLineSpacing HorizontalAlignment HasHorizontalAlignment VerticalAlignment HasVerticalAlignment Orientation HasOrientation Opaque HasOpaque TrueColor HasColor Layer
65-4 65-4 65-4 65-4 65-5 65-5 65-5 66-1 66-1 66-1 66-1 66-2 66-2 66-2 66-2 66-3 66-3 66-3 66-3 66-3 66-4 66-4 66-4 66-4 66-5 66-5 66-5 66-5 66-5 67-1 67-1 67-1 67-1 67-2 67-2 67-2 67-2 67-3 67-3 67-3 67-3 67-4 67-4 67-4 67-4 67-4 67-5 67-5 67-5 67-5 67-6 67-6 67-6 67-6 67-6
HasLayer DisplayLevel HasDisplayLevel Copy Methods GetFont SetFont Chapter 68 ImageAttributes Properties TrueColor HasColor Layer HasLayer DisplayLevel HasDisplayLevel Comment HasComment Copy Chapter 69 Stack Properties NrOfItems Methods Push Pop Clear Chapter 70 Queue Properties NrOfItems Methods PutItem GetItem Clear Chapter 71 Tree Properties NrOfItems Methods Insert Delete Clear GetFirst GetNext Chapter 72 Window Properties HasHorScrollBar HasVertScrollBar Width Height Position ScreenPosition HorScrollThumb VertScrollThumb Methods Minimize Maximize
67-7 67-7 67-7 67-7 67-8 67-8 67-8 68-1 68-1 68-1 68-1 68-1 68-2 68-2 68-2 68-2 68-2 68-3 69-1 69-1 69-1 69-1 69-1 69-1 69-2 70-1 70-1 70-1 70-1 70-1 70-1 70-2 71-1 71-1 71-1 71-1 71-1 71-2 71-2 71-2 71-2 72-1 72-1 72-1 72-1 72-1 72-2 72-2 72-2 72-3 72-3 72-3 72-3 72-3
Restore SetWindowSize Chapter 73 PathElement Properties ElementType Sequence Length BeginPoint EndPoint Line Arc Clothoid Chapter 74 Properties Chapter 75 Properties Radius Center PathLine PathArc
72-4 72-4 73-1 73-1 73-1 73-1 73-2 73-2 73-2 73-2 73-2 73-3 74-1 74-1 75-1 75-1 75-1 75-1 76-1 76-1 76-1 76-1 76-2 76-2 76-2 76-2 77-1 77-1 77-1 77-2 77-2 77-2 77-3 77-3 77-3 77-4 77-4 77-4 77-5 77-5 78-1 78-1 78-1 78-1 78-1 78-2 78-2 78-2 78-2 78-2 78-3 78-3 78-3
Chapter 76 PathClothoid Properties ClothoidConstant StartRadius EndRadius StartCenter EndCenter Mirror Chapter 77 GeoMath Methods Distance (or dS) dZ NOT IMPLEMENTED Projection Intersections NOT IMPLEMENTED NewPoint NewLine NewArc NewCircle NewCircle3P NewPolygon NewCurve NewClothoid Chapter 78 GeoObject Properties Horizontal Z ObjectType Methods GetPoint GetLine GetArc GetCircle GetClothoid GetCurve GetPolygon
Copy
(Incorrectly implemented)
78-3 79-1 79-1 79-1 79-1 79-1 79-2 79-2 79-2 79-2 80-1 80-1 80-1 80-1 80-1 81-1 81-1 81-1 81-1 81-2 81-2 81-2 81-2 82-1 82-1 82-1 82-1 82-2 82-2 82-2 83-1 83-1 83-1 83-1 83-2 83-2 83-2 83-2 83-3 83-3 84-1 84-1 84-1 84-1 84-1 84-2 84-2 85-1 85-1 85-1 85-1 85-1 85-2
Chapter 79 GeoPoint Properties XYZ XY X Y Z Methods GetGeoObject Chapter 80 GeoLine Properties P1 and P2 Methods GetGeoObject Chapter 81 GeoArc Properties C P1 P2 Radius Methods GetGeoObject Chapter 82 GeoCircle Properties C P Radius Methods GetGeoObject Chapter 83 GeoClothoid Properties P1 P2 R1 R2 K Mirror Methods GetGeoObject Chapter 84 GeoCurve Properties NrOfPoints Methods SetPoints GetPoints GetGeoObject Chapter 85 GeoPolygon Properties NrOfPoints Area Perimeter Centroid
Methods SetPoints GetPoints GetGeoObject Chapter 86 MatrixOperations Methods NewMatrix NewIdentityMatrix IsEqual Add Multiply Transpose Inverse Solve Determinant Chapter 87 HelmertTransformation Properties NumberOfPassPoints TranformationParameters StandardDeviation Methods Calculate GetResiduals GetDelaunayTriangulation Transform Chapter 88 DelaunayTriangulation Properties NumberOfPoints NumberOfTriangles Methods Initialise GetFirst GetNext NaturalNeighbours PointInTriangulation Interpolation Chapter 89 XMLDocument Properties Version Standalone Comments1 Comments2 Comments3 Main Methods Clear WhiteSpaceNormalize Save Chapter 90 Properties ItemType Text PI Comment XMLItem
85-2 85-2 85-2 85-2 86-1 86-1 86-1 86-2 86-2 86-3 86-3 86-3 86-4 86-5 86-5 87-1 87-1 87-1 87-2 87-2 87-2 87-2 87-2 87-3 87-3 88-1 88-1 88-1 88-2 88-2 88-2 88-2 88-2 88-2 88-3 88-3 89-5 89-5 89-5 89-6 89-6 89-6 89-6 89-6 89-7 89-7 89-7 89-7 90-9 90-9 90-9 90-9 90-10 90-10
Element Document NextItem WhiteSpace Chapter 91 XMLItems Properties Parent NrOfItems CurrentItem FirstItem NextItem NrOfElements FirstElement NextElement Methods Clear Copy WhiteSpaceNormalize AddText AddPI AddComment AddElement RemoveItem Chapter 92 XMLText Properties Item NextItem Document Content SpaceBefore Chapter 93 XMLPI Properties Item NextItem Document Target Content WhiteSpace Chapter 94 XMLComment Properties Item NextItem Document Content Whitespace Chapter 95 XMLElement Properties Item NextItem Document Whitespace NextElement NrOfAttributes FirstAttribute
90-10 90-10 90-10 90-11 91-13 91-13 91-13 91-13 91-14 91-14 91-14 91-14 91-14 91-15 91-15 91-15 91-15 91-15 91-16 91-16 91-17 91-17 91-17 92-19 92-19 92-19 92-19 92-19 92-19 92-20 93-21 93-21 93-21 93-21 93-21 93-21 93-22 93-22 94-23 94-23 94-23 94-23 94-23 94-23 94-24 95-25 95-25 95-25 95-25 95-26 95-26 95-26 95-26 95-26
Name Value SubItems Methods GetAttribute AddAttribute RemoveAttribute RemoveAttributes CopyAttributes Clear Copy WhiteSpaceNormalize Chapter 96 XMLAttribute Properties Element Name Value WhiteSpace NextAttribute Chapter 97 KML Introduction Purpose Structure of KML Object Example Chapter 98 KMLFolder Properties Name Features Methods GetFeature Save Chapter 99 KMLFeatures Properties NrOfFeatures IsEmpty Iterator Methods Add Clear Chapter 100 Properties Valid EndOfList Methods GetFirst GetNext Insert Remove KMLFeaturesIterator
95-27 95-27 95-27 95-27 95-27 95-28 95-28 95-28 95-28 95-29 95-29 95-29 96-31 96-31 96-31 96-31 96-31 96-31 96-32 97-33 97-33 97-33 97-35 98-1 98-1 98-1 98-1 98-1 98-1 98-2 99-1 99-1 99-1 99-1 99-1 99-2 99-2 99-2 100-1 100-1 100-1 100-1 100-1 100-1 100-2 100-2 100-2 101-1 101-1 101-1 101-1 101-1 101-1
Chapter 102 - KMLPlacemark Properties Name Geometry Methods GetFeature SetLineStyle GetLineStyle SetPolyStyle GetPolyStyle SetIconStyle GetIconStyle Chapter 103 - KMLGeometry Properties GeometryType Methods GetPoint GetLineString GetPolygon Chapter 104 - KMLPoint Properties GeoPoint Methods GetGeometry Chapter 105 - KMLLineString Properties Coordinates LinearRing AltitudeMode Extruded Methods GetGeometry Chapter 106 - KMLPolygon Properties AltitudeMode Extruded OuterBoundary InnerBoundary Methods GetGeometry Chapter 107 - KMLInnerBoundary Properties NrOfCutouts IsEmpty Iterator Methods Add Clear Chapter 108 Properties Valid EndOfList Methods KMLInnerBoundaryIterator
102-1 102-1 102-1 102-1 102-1 102-1 102-2 102-2 102-2 102-2 102-2 102-3 103-1 103-1 103-1 103-1 103-1 103-2 103-2 104-1 104-1 104-1 104-1 104-1 105-1 105-1 105-1 105-1 105-1 105-2 105-2 105-2 106-1 106-1 106-1 106-1 106-1 106-2 106-2 106-2 107-1 107-1 107-1 107-1 107-1 107-2 107-2 107-2 108-1 108-1 108-1 108-1 108-2
GetFirst GetNext Insert Remove Chapter 109 - KMLCoordinates Properties NrOfCoordinates IsEmpty Iterator Methods Add Clear Chapter 110 Properties Valid EndOfList Methods GetFirst GetNext Insert Remove Chapter 111 Properties GeoPoint KMLCoordinatesIterator
108-2 108-2 108-2 108-3 109-4 109-4 109-4 109-4 109-4 109-5 109-5 109-5 110-1 110-1 110-1 110-1 110-2 110-2 110-2 110-2 110-3 111-1 111-1 111-1 112-1 112-2 112-2 112-2 112-3 112-3 112-3 112-3 112-3 112-4 112-4 112-4 112-4 112-4 112-5 112-5 112-5 112-5 112-6 112-6 112-7 112-7 112-7 112-7 112-7 112-7 112-8 112-8 112-8 112-9
KMLCoordinate
Chapter 112 - Units Properties UnitOfLength AngleUnit HorizontalAngleClockwise VertAngleType XYZRepresentation RectangleCoordRepr ScaleFormat ChainageFormat DecimalSeparator ItemSeparator DecimalPlacesForAngles DecimalPlacesForLengths DecimalPlacesForXYCoords DecimalPlacesForAreas DecimalPlacesForVolumes LongDateFormat ShortDateFormat TimeFormat AM PM ValidLongDateFormat ValidShortDateFormat ValidTimeFormat DateTimeFixedLength MaximumYear Methods SetTransformation GetTransformation
ConvertCoordinatesToUser ConvertCoordinatesToInternal ConvertLengthToUser ConvertLengthToInternal ConvertAngleToUser ConvertAngleToInternal ConvertAreaToUser ConvertAreaToInternal ConvertVolumeToUser ConvertVolumeToInternal StrConvertCoordinatesToUser StrConvertCoordinatesToInternal StrConvertLengthToUser StrConvertLengthToInternal StrConvertChainageToUser StrConvertAngleToUser StrConvertAngleToInternal StrConvertAreaToUser StrConvertAreaToInternal StrConvertVolumeToUser StrConvertVolumeToInternal FormatLongDate FormatShortDate FormatTime StringToDateTime StringToDate StringToTime GetPreferences SetPreferences Chapter 113 - Comm Properties Baudrate StopBits Parity HandShaking NrOfBits Port Methods OpenLink CloseLink Read Write ClearInputBuffer Chapter 114 - Timer Properties ElapsedTime Interval CallBackMacro Methods Start Stop Chapter 115 - Progress Properties CancelButton Message
112-9 112-10 112-10 112-11 112-11 112-11 112-11 112-12 112-12 112-12 112-12 112-13 112-13 112-14 112-14 112-14 112-14 112-14 112-15 112-15 112-15 112-15 112-16 112-16 112-16 112-16 112-17 112-17 112-17 113-1 113-1 113-1 113-1 113-2 113-2 113-2 113-2 113-2 113-2 113-3 113-3 113-4 113-4 114-1 114-1 114-1 114-1 114-1 114-2 114-2 114-2 115-1 115-1 115-1 115-1
Title Percentage Cancelled Methods Start Stop Chapter 116 Properties NrOfFonts Methods GetFirst GetNext Fonts
115-2 115-2 115-2 115-2 115-2 115-3 116-1 116-1 116-1 116-1 116-1 116-1 117-1 117-1 117-1 117-1 117-2 117-2 117-2 117-2 117-2 117-2 117-3 118-1 118-1 118-1 118-1 118-2 118-2 118-2 118-2 118-2 118-3 118-3 119-1 119-1 119-1 119-2 119-2 119-2 119-3 119-3 120-1 120-1 120-1 120-1 120-2 120-2 120-3 120-3 121-1 121-2 121-2
Chapter 117 - Folder Properties NrOfFolders NrOfFiles Path Methods Assign FirstFolder NextFolder FirstFile NextFile Chapter 118 - File Properties Drive Path Name Extention FullName FileType Application Methods Assign Chapter 119 Methods Connect Select FetchNext GetData Cancel FreeStmt ODBCDataSource
Chapter 120 - Dialogs Methods RequestFileOpen RequestFilesOpen RequestFolderOpen RequestFileSave RequestTextFileView GetTrueColor Chapter 121 Form Events Initialize Form Modules
Modality Terminate QueryClose Click DropButtonClick DblClick Change Form Control Methods and Properties Form Object Caption Floating Show Hide OpenForm CloseForm GetPosition SetPosition Width Height ScreenWidth ScreenHeight Common properties SetFocus Visible Enabled ControlTipText TextBox Control Value ( = Text) MaxLength Locked SetFocus, Visible, Enabled, ControlTipText Label Control Caption Visible, Enabled, ControlTipText CommandButton Control Value Caption Visible, Enabled, SetFocus, ControlTipText ToggleButton Control Value Caption Visible, Enabled, SetFocus, ControlTipText CheckBox Control Value Caption Visible, Enabled, SetFocus OptionButton Control Value Caption Visible, Enabled, SetFocus, ControlTipText SpinButton Control Value Locked Visible, Enabled, SetFocus, ControlTipText Frame Control Caption
121-3 121-3 121-3 121-3 121-4 121-4 121-4 121-4 121-5 121-5 121-5 121-5 121-5 121-6 121-6 121-6 121-6 121-6 121-6 121-6 121-7 121-7 121-7 121-7 121-7 121-7 121-8 121-8 121-8 121-8 121-8 121-8 121-8 121-8 121-8 121-8 121-9 121-9 121-9 121-9 121-9 121-9 121-9 121-9 121-10 121-10 121-10 121-10 121-10 121-10 121-10 121-10 121-10 121-11 121-11 121-11
ControlTipText ListBox Control ColumnTitle (synonym ListHeader) Text ListCount ListIndex List ColumnWidths AddItem RemoveItem Clear Selected SetFocus, Visible, Enabled, ControlTipText DropDownList Control Text ListCount ListIndex List AddItem RemoveItem Clear SetFocus, Visible, Enabled, ControlTipText Combobox Control Value Text MaxLength Clear ListCount, ListIndex, List, AddItem, RemoveItem SetFocus, Visible, Enabled, ControlTipText Multipage Control Caption Value Visible, Enabled, ControlTipText Chapter 122 - Pythagoras Data Types XYZ XY XYV KMLGeoPoint RGB KMLColor Rectangle ObliqueRectangle Transformation TransformationParameters Style SelectionCriteria RowSetDefinition SelectCondition MatchCondition WhereCondition ColumnDefinition DocInfo WindowCoord Line2D Line3D LinePair
121-11 121-11 121-11 121-11 121-11 121-11 121-12 121-12 121-12 121-12 121-13 121-13 121-13 121-13 121-13 121-13 121-13 121-14 121-14 121-14 121-14 121-14 121-15 121-15 121-15 121-15 121-15 121-15 121-15 121-15 121-15 121-16 121-16 122-1 122-1 122-1 122-1 122-1 122-2 122-2 122-2 122-2 122-3 122-3 122-3 122-4 122-4 122-5 122-5 122-6 122-6 122-7 122-8 122-8 122-8 122-8
ColumnValue ValueIndex UUID ProfileElement HorizontalTransition SuperElevationPoint SuperElevationData SystemParameters Font Location DTMReduce Chapter 123 - Constants Language Constants Button Display constants Icon Display constants Default button constants Modality constants MsgBox return value constants Types constants Compare constants String constants Day of week constants File System constants Pythagoras Object Model Constants General Ok - Not Ok SortOrder Group Language State of Subdocument SaveBeforeClose Overlay type Colors Length Units Angle Units Vertical Angle XYZ Representation Representation of rectangular coordinates Angle type Scale Format Chainage Format Point Style Line Style Arrows on end point of lines Document Version Selection Compare / Condition Type of intersection ObjectTypes Annotation Codepage Text Style Text Weight Text: horizontal alignment Text: vertical alignment Text: underline
122-9 122-9 122-9 122-9 122-10 122-10 122-10 122-10 122-11 122-11 122-11 123-1 123-1 123-1 123-1 123-1 123-1 123-1 123-1 123-1 123-1 123-2 123-2 123-2 123-2 123-2 123-2 123-2 123-2 123-3 123-3 123-3 123-3 123-3 123-3 123-3 123-4 123-4 123-4 123-4 123-4 123-4 123-4 123-4 123-4 123-5 123-5 123-5 123-5 123-5 123-6 123-6 123-6 123-6 123-6 123-6
Text: border Text: line spacing Text: orientation Images: ColorDepth Polygon: styleId Polygon: border KML: Type of KML Objects KML: Altitude Mode PTPosition Results from PointInPolygon method Type of coordinate system Paste operations Symbol Type View: Visible attributes Symbol Class Database: type of table constants Database: name category constants Database: table access constants Database: reaction on pending references constants Database: PtCompare Database: ptRowSetType Database: RowSet Base Overlay (PtRowSetBaseOverlay) Database: PtQueryType Database: PtMatchConditionKind Database: PtObjectFunction Database: PtAggregateFunction Database: PtSyntaxError Database: PtQueryValidity Table Import: PtImportCompletion Vertical Curve : Fixed/Variable Radius or Length Vertical Curve Path Sequence Path Element Type Road Cross Section Element Type Road Horizontal Alignment Transition Type Road Superelevation Point Type Annotation format Areas Serial port settings : stop bits Serial port settings : parity Serial port settings : handshaking Serial port settings : read/write User Menu Type of Toolbar Buttons Bitmaps - Private Tool Cursors End Of Cross Section Elevation/Value unknown Import DWG parameters Export Shape parameters Program options Pythagoras specific types Type of Coordinate Reference System Type of Interpolations URL Download results Synchronize Dictionary Data Options Charsets
123-6 123-6 123-6 123-7 123-7 123-7 123-7 123-7 123-7 123-8 123-8 123-8 123-8 123-8 123-8 123-8 123-8 123-8 123-8 123-9 123-9 123-9 123-9 123-9 123-9 123-10 123-10 123-10 123-11 123-12 123-12 123-12 123-12 123-12 123-12 123-12 123-12 123-12 123-12 123-12 123-13 123-13 123-13 123-13 123-13 123-14 123-14 123-14 123-14 123-14 123-14 123-14 123-14 123-14 123-14 123-15
XMLDocumentVersion XMLItemType XMLWhiteSpaceFacet XMLCompletionCode Pythagoras virtual key codes Constants Windows Macintosh Chapter 124 - Error handling Introduction Pythagoras VBA errors Pythagoras errors Chapter 125 - Pythagoras VBA language elements Option Statement Base Explicit Compare MSCompatible Special values Nothing Empty Null Operators Arithmetic Operators String Operators Comparison Operators Logical Operators Variable Declaration Const Dim User-Defined type Enumeration type ReDim Procedure & Function Declaration Sub Function Calling Procedures and Functions Program Structure and flow Do ... Loop Exit For ... Next If ... Then ... Else Select Case ... End Select With ... End With Data Type Conversion Functions CBool CByte CDbl CInt CLng CSng CStr CDate CVErr Fix Int
123-19 123-19 123-19 123-19 123-20 123-20 123-22 124-1 124-1 124-1 124-3 9 9 9 9 9 9 9 10 10 10 10 10 11 11 11 11 11 11 12 12 12 13 13 13 14 15 15 15 15 16 16 16 17 17 17 17 18 18 18 18 18 19 19 19
Round Str Val Err Object Clear Description Number On Error Raise Resume Source File Handling FreeFile Open Close Reset Print Line Input Write Input Put Get Seek Function Seek Statement Lock Unlock Kill Loc Eof Lof FileAttr FileCopy FileLen Dir MkDir Interaction Functions InputBox MsgBox Function/Statement Math Functions Abs Atn Cos Exp Log Sgn Sin Sqr Tan String Manipulation Asc Chr Format InStr InStrRev LCase Left
19 19 20 20 20 20 20 20 21 21 22 22 22 22 23 23 23 23 23 23 24 24 24 25 25 25 25 25 26 26 26 26 26 27 27 27 27 28 28 28 28 28 28 28 28 29 29 29 29 29 29 29 31 31 31 31
Len LTrim Mid Function Mid Statement Right RTrim Space Spc StrComp String Tab Trim UCase Date functions Date literals Date DateAdd DateDiff DatePart DateSerial Day Hour Minute Month MonthName Now Second Time TimeSerial TimeValue Weekday WeekdayName Year Various TypeName VarType IsArray, IsDate, IsEmpty, IsNull, IsError, IsNumeric, IsObject UBound LBound Beep AppActivate Shell Declare End
31 32 32 32 32 32 32 33 33 33 33 33 34 34 34 34 34 35 35 35 36 36 36 36 36 37 37 37 37 37 38 38 38 38 38 38 39 39 39 39 40 40 40 41
Chapter 1 - Introduction
How to read this manual?
This manual is in the first place a reference manual. There are nearly 100 classes with in total more than thousand properties and methods. Too much to be remembered by a normal human being. Reading this introduction is a must, although the sections "Events" and "Private Tool" may be skipped on the first reading. Afterwards read the short description at the start of each chapter an try to understand the meaning of each class. Having a look to the names of properties and methods can help to get an insight in the purpose and possibilities of the class. It is evident that for the classes that are related to Pythagoras Objects, general knowledge of Pythagoras is required. This manual does not explain the meaning of Layer, Sheet, Subdocument, Symbol, or whatever Pythagoras term. Once you start to understand the major classes: Application, Document, Overlay, CadObject, ... you can start to write simple applications and step by step you will get an insight of the powerfull features of the Pythagoras VBA Object Model. If you are not familiar with the language VBA, we advise to read first Fout! Verwijzingsbron niet gevonden.Pythagoras VBA Language Elements and program and test some simple programs before starting reading other chapters.
General
Remarks The examples used in this manual are strictly educational. They all compile, but it is not guaranteed that they will also run, for lack of a proper code environment
Pythagoras VBA
What is Pythagoras VBA? Pythagoras VBA is a programming environment in Pythagoras that allows the user to write its own extensions to Pythagoras. The programming language "Pythagoras VBA" is nearly identical to the language used by the Microsoft products Visual Basic and MS-Office VBA. The way Pythagoras objects (Document, Point, Line, etc) are accessed from VBA is similar to the access of objects in the MS-Office products. 1. Main differences between Microsoft VBA and Pythagoras VBA The programming environment of both systems is completely different. The programming environment of Pythagoras VBA is described later in this manual The main language principles of Pythagoras VBA and Microsoft VBA are the same. So the declaring subroutines, variables, the use of control structures and error handling is the same. The following language VB language data types are not supported in Pythagoras VBA: Currency Decimal Collections In Pythagoras VBA, variables must be predefined. Most standard functions of Visual Basic are also available in Pythagoras VBA. The standard VB mathematical functions, string functions, and file input/output functions are provided. An overview of the Pythagoras VBA language elements is given further in this manual. In contrast to Microsoft VBA, the Pythagoras Object Model is not accessible from outside. Calls to other COM components are possible from Pythagoras Macros. Access to COM components is not supported in the Macintosh version of Pythagoras.
Introduction
Page 1-1
2. The Pythagoras Object Model The Pythagoras Object Model allows access to nearly all Pythagoras objects such as documents, drawing elements (lines, points, ), layers, the selection, to name just a few. This model is ve ry powerful and it allows programmers to extend the functionality of Pythagoras. The main part of this manual describes the Pythagoras Object model in detail. The Pythagoras Object Model contains also classes that are not related to Pythagoras Objects. Some examples: Folder, File, Comm, Timer, Progresss, Dialogs, ODBCDataSource, HelmertTransformation, AffineTransformation, DelaunayTriangulation, GeoObject, GeoMath, GeoPoint, GeoLine, .. These classes will make it much easier to write some applications without the need to interface with DLL's. Almost all properties and methods do just the action described in this manual and have no side effects. A few properties and methods result in clearing the Undo-system of the document on which they have effect. An example: deleting a layer will clear the Undo-system of the document. The reason: undo/redo is only applicable to objects and not to layers, sheets, subdocuments, etc. Allowing Undo could make the document inconsistent. The description mentions this side effect for all the properties and methods involved.
This overview only represents the main dependencies of the Pythagoras Objects. We recommend consulting this overview regularly while studying the Pythagoras Object Model. 3. Pythagoras Macro Libraries VBA subroutines are called Macros. One or more macros are stored in a module. One or more modules make up a library. A library can contain Code Modules and Form Modules (Class Modules are not Introduction
Page 1-2
supported in the current version of Pythagoras VBA). Libraries are stored either in the Macro System Libraries file (Pythagoras.mlb) or in a Pythagoras document. So the Pythagoras.mlb file may contain multiple libraries, and each library may contain multiple macros. When Pythagoras is launched, the Pythagoras.mlb file will be loaded in memory. If a Startup Library is specified, the startup library will be compiled. If the startup library contains a macro with the name OnStartUp, then this macro will be executed. This way, the default environment of Pythagoras can be personalized at startup of Pythagoras. When a document contains one ore more libraries, these libraries will be read in memory when the document is opened and becomes the top window. Similar as with the system libraries, a document library may contain a Startup Library. This feature allows personalizing the Pythagoras environment when a specific document is opened. At a given moment only one macro library, either a system- or a document macro library, can be active. This means that only macros of the active (loaded) library can be executed. It is not possible to call macros from other libraries.
4. Access to Protected and Invisible objects VBA can not change objects which are protected. If the VBA programmer wants to do so, the protection of the layer has to be removed. No error or exception is given. Operations on objects, which are in a layer, which is not visible, will be executed without any warning.
Getting started
The design and maintenance of a macro is best done in a document macro library. A document library can be easily moved to the system library. The document with its libraries can be easily passed on to other users. Step 1 : open a new document and give the document a name. Step 2 : create a document library a) Select File, Macros, Macro Library Manager...
b) Select the radio button "Document Libraries", type the name of the new library and click New.
Introduction
Page 1-3
Step 4 : Select menu File, Macros, Macro Editor to edit the macro.
The use of the macro editor is straightforward. Try out the menu items to become familiar with the functions of the macro editor. When the name of a Sub starts with PM_ (e.g. PM_MyFirstMacro), that macro will be added in the menu Tools, Run Macro. The macro can be directly called from there. Use of such macros is useful for testing or for very simple VBA applications. Step 5 : Creating forms The form resource and the form code are stored in a Form module. Select New Form from the File menu.
An empty form module will be opened. In the form module you need to write the Form Event macros. Use the menu Run, Form to create a new form or the edit an existing one. The right mouse button is used in the form to create new controls, align, etc.
Introduction
Page 1-4
Tips & trics about forms a) Controls that are created in, or moved to, a GroupBox or MultiPage become a member of the group or multipage. Moving a GroupBox or MultiPage will move also the members. b) When deleting a Groupbox or MultiPage, the members are also deleted. If you dont want this behaviour, you first have to move out the controls. c) The form editor has no undo system. But when quitting the form editor you have the option to save or restore the form. Before doing some complex editing operations, temporary quit and save the form.
Introduction
Page 1-5
When selecting the menu item Export Form when a form module has the focus, and the CTRL-key is hold down, the form can be exported in a readable format (CSV-file). This file on its turn can be imported in a spreadsheet program. 2. Import VBA Sources and Forms When selecting the menu item Import VBA Sources and Forms... you need to specify a directory from where the sources and forms will be read. All files in the given directory with the extentions .bas and .frm will be imported. The .frx files (form resources) will be imported in the form source in case the form source was present. If one or more modules already exist, a message will be given with the posibility to overwrite the modules or cancel the operation. When selecting the menu item Import Form when a form module has the focus, a form resource that has been previously exported can be imported. This allows copying a form to another macro.
Events
The main purpose of introducing event macros is to give the VBA user the possibility to filter mouse and other window events. This allows the user to modify the common mouse actions, to create his own shortcuts, to execute code by the creation or opening of a document or to add his own menu items.In short, to customize the overall behavior of Pythagoras. 1. Calling Event macros The mechanism of the event macros is the following. The general message loop or event filter will trap, if some conditions are met, all events that can have a macro. If an event occurs, it will execute the VBA macro with a predefined fixed name. The VBA macro can execute all required actions, for example moving an object. When the event macro is executed Pythagoras will still execute the default actions, unless the event macro requests otherwise (see StopEvent). Some events are only trapped if a document is opened; some are trapped with or without open documents. Events are not related to a specific document. It is up to the event macro to decide what action may be done or not on a specific document. On the other hand, we can make a restriction between mouse events in profile, document or typical section. 2. Type of events
Introduction
Page 1-6
Private Tools
Private Tools allow the user to sent mouse events to macros (event macros). These macros will then respond on the proper operation of the mouse. When Pythagoras is in a Private Tool Mode, the program searches for event macros and executes them. The event macros that can be used in Pythagoras are: OnMouseMove OnMouseDown OnMouseUp OnMouseDoubleClick OnRightMouseDown OnRightMouseUp OnRightMouseDoubleClick OnMiddleMouseDown OnMiddleMouseUp OnMiddleMouseDoubleClick The Private Tool is by default disabled. If the property MenuEnabled is set TRUE, then the Private Tool can be selected. The property MenuString gives the opportunity to change the name of this menu item to a more relevant one. A VBA macro can a.o. - Enable Private Tool - Change the name MenuEnabled = True MenuString
When a library is closed (e.g. when another library is loaded), the Private Tools will be removed.
Introduction
Page 1-7
When a Private Tool item is selected, the standard behavior will be the same as in Select mode. When receiving Mouse events, Pythagoras will execute the appropriate event Macro if the Macro is defined in the active VBA library. An Event Macro can suppress the standard behavior by calling the StopEvent method. Standard behavior can be restored by calling the ContinueEvent method. StopEvent has to be called before returning from an Event Macro. In other situations, calling StopEvent has no effect. For more information see objects PrivateTool and PrivateTools. Note: the Application methods related to private tools became redundant in Pythagoras 13.
Introduction
Page 1-8
Chapter 2 - Application
Description The Application object is the top-level object of the Pythagoras Object Model. Most of the other object references are obtained via the Application object. Example
Dim A As Application Dim Doc As Document Set A = New Application A.GetNewDocument Doc
Properties
GetPrivateTools PrivateToolMenuEnabled PrivateToolMenuString PrivateToolSelected PrivateToolSnapping PrivateToolTargetEnabled PrivateToolTargetType PrivateToolTargetPosition LicenceNumber Language Version VersionStr ApplicationDirectory UserProfileDirectory PublicDirectory TemporaryDirectory PythagorasLocalDirectory CodeDescriptionFile SystemClipboard SystemDate SystemParameters IgnoreDataErrors NilUUID NegativeInfinity PositiveInfinity NaN NewToolbarButton RemoveToolbarButtons EnableToolbarButton NewUserMenu RemoveUserMenu AppendUserMenuItem AppendUserPopupMenuItem AppendUserSubMenuItem RemoveUserMenuItem RemoveUserSubMenuItem EnableUserMenuItem CheckUserMenuItem OpenDocument GetNewDocument PutDocumentOnTop GetActiveDocument Wait ContinueEvent StopEvent SetEventKeys GetEventKeys ConvertImage GetDocuments GetSymbolLibrary
Methods
Application
Page 2-1
GetCoordinateReferenceSystems GetTiePointsSetCollection TileWindows CascadeWindows AddToRecentTextFiles OpenExternalFile GetPathName GetFileName Intersection2Lines Intersection BestLine BestArc BestCircle ProjectionOnLine OptionSupported ColumnValue SelectCondition NameCategory RowSetDefinition MatchCondition WhereCondition ColumnCondition CreateUUID IsNilUUID UUIDToString StringToUUID UUIDToDate Parse TrueColorToColor ColorToTrueColor GetUserDefaults GetAttributesSet SetVBADefaultAttributes UTF8ToASCII UTF8ToASCIIV ASCIIToUTF8 IsNegativeInfinity IsPositiveInfinity IsInfinity IsNaN SortAll Sort SortValueIndex IncPointIdent InitSelectionCriteria DebugInput DebugOutput
XML Methods
CreateXMLDocument ReadXMLDocument GetXMLErrorPosition XMLReplaceWhites XMLCollapseWhites XMLWhiteSpaceNormalize XMLStringToBoolean XMLStringToInteger XMLDecimalStringToReal XMLStringToReal XMLStringToDateTime XMLStringToTime XMLStringToDate XMLStringToUTCDateTime XMLStringToUTCTime XMLDivideString
Application
Page 2-2
XMLStringToBooleans XMLStringToIntegers XMLDecimalStringToReals XMLStringToReals XMLStringToDateTimesZ XMLStringToTimesZ XMLStringToDatesZ XMLStringToDateTimes XMLStringToTimes XMLStringToDates XMLStringToUTCDateTimes XMLStringToUTCTimes XMLBooleanToString XMLIntegerToString XMLRealToDecimalString XMLRealToString XMLDateTimeToString XMLTimeToString XMLDateToString XMLUTCDateTimeToString XMLUTCTimeToString XMLUniteStrings XMLBooleansToString XMLIntegersToString XMLRealsToDecimalString XMLRealsToString XMLDateTimesToString XMLTimesToString XMLDatesToString XMLUTCDateTimesToString XMLUTCTimesToString XMLValidName
Properties
GetPrivateTools Parameters
PrTools As PrivateTools
PrivateToolMenuEnabled Returns
Boolean
Description Returns the status of the Private Tool menu item or sets the Private Tool menu item enabled or disabled. The Private Tool menu can only be selected if a Macro has executed the statement. Note: this property became redundant. We recommend to use PrivateTools and PrivateTool objects introduced in Pythagoras 13. New functionality will only be added in the new classes. Example
Dim A As Application If A.PrivateToolMenuEnabled = False Then A.PrivateToolMenuEnabled= True End If
Application
Page 2-3
PrivateToolMenuString Returns
String
Description Changes or returns the name of the Private Tool menu item. The maximum length of a menu name is 32 characters. Note: this property became redundant. We recommend to use PrivateTools and PrivateTool objects introduced in Pythagoras 13. New functionality will only be added in the new classes. Example
Dim A As Application If A.PrivateToolMenuString = "GPS Roving" Then End If
PrivateToolSelected Returns
Boolean
Description Returns True if the Private Tool is active. When setting, the Private Tool is activated or deactivated. Note: this property became redundant. We recommend to use PrivateTools and PrivateTool objects introduced in Pythagoras 13. New functionality will only be added in the new classes. Example
Dim A As Application Dim GPSPos As XYZ If A.PrivateToolSelected Then A.PrivateToolTargetPosition = GPSPos A.PrivateToolTargetEnabled = True End If
PrivateToolCursor Returns
Integer
Description Sets the type of the cursor when the private tool is active. The cursor type remains active until either the macro library is terminated or when the property PrivateToolCursor is changed. The value is any of the constants specified in section Chapter 123 - Constants, item Cursors. Note: this property became redundant. We recommend to use PrivateTools and PrivateTool objects introduced in Pythagoras 13. New functionality will only be added in the new classes. Example
Dim A As Application If A.PrivateToolSelected Then A.PrivateToolCursor = ptCursorP1 End If
PrivateToolSnapping Returns
ObjectTypes As Long
Description Sets or returns the types of objects that Pythagoras will snap to when the user has selected the Private Tool before calling the OnMouseMove Event Macro. The value ObjectTypes specifies the types of objects (points, lines, ...) the cursor will snap to in the Private Tool Mode. So if
Application
Page 2-4
A.PrivateToolSnapping = ptPoint, the cursor will only snap to points. ObjectTypes is defined as the sum of one or more constants of the type ObjectTypes defined in the section "Constants" of this document. If A.PrivateToolSnapping = ptAll , the cursor will snap to all object types. If A.PrivateToolSnapping = ptNoObjects, the cursor will not snap to any object. Even if there is no OnMouseMove Event Macro, the cursor will snap only to the objects set by this property. When ptLine and ptPoint is in ObjectTypes, cursor will also snap to intersection points of lines. The default value when a Macro Library is loaded = ptAll. Note: this property became redundant. We recommend to use PrivateTools and PrivateTool objects introduced in Pythagoras 13. New functionality will only be added in the new classes. Example
Dim A As Application set A = New Application A.PrivateToolSnapping = ptPoint + ptLine
PrivateToolTargetEnabled Returns
Boolean
Description Returns or sets the status of the Target. If the target is enabled, a marker is displayed on the screen on the document position given by the property PrivateToolTargetPosition. The default target type = ptGPSPositionFound. Note: this property became redundant. We recommend to use PrivateTools and PrivateTool objects introduced in Pythagoras 13. New functionality will only be added in the new classes. Example
Dim A As Application If A.PrivateToolTargetEnabled = False Then A.PrivateToolTargetEnabled = True End If
PrivateToolTargetType Returns
Integer
Description Sets the type of the Target (marker) when PrivateToolTargetEnabled = True . The value can be either ptGPSPositionFound or ptGPSSearchingPosition. Note: this property became redundant. We recommend to use PrivateTools and PrivateTool objects introduced in Pythagoras 13. New functionality will only be added in the new classes. Example
Dim A As Application If A.PrivateToolTargetEnabled = False Then A.PrivateToolTargetEnabled = True A.PrivateToolTargetType = ptGPSSearchingPosition End If
PrivateToolTargetPosition Returns
XYZ
Application
Page 2-5
Description Sets the position of the target. The position is in local coordinates. The target is a marker on the screen, and is used to highlight a position. This could be for example the position received from GPS equipment. The display of the target has only effect if the Private Tool is selected. This is a write-only property. Note: this property became redundant. We recommend to use PrivateTools and PrivateTool objects introduced in Pythagoras 13. New functionality will only be added in the new classes. Example
Dim A As Application Dim GPSPos As XYZ A.PrivateToolTargetPosition = GPSPos
LicenceNumber Returns
Variant
Description This property returns the actual used license number of the Pythagoras protection key (dongle). Example
Dim A As Application set A = New Application MsgBox CStr(A.LicenceNumber)
Language Returns
Integer
Description This property returns the language of the Pythagoras application. For constants of languages see Chapter 123 - Constants Example
Dim A As Application set A = New Application If A.Language = ptAppDutch Then End If
Version Returns
Integer
Description This property returns the version of Pythagoras. The returned value: main version * 100 + minor version. Example: V12.05 will return the value 1205. Every new value of Pythagoras will return a value that is larger than previous version. Example
Dim A As Application Set A = New Application If A.Version >= 1210 Then End If
VersionStr Returns
String
Description This property returns the version in string format of Pythagoras. Application
Page 2-6
Example
ApplicationDirectory Returns
String
Description This property returns the directory of the Pythagoras application (Pythagoras.exe). It is advised not to place own files or to change existing files in this directory: starting from Windows Vista this directory can be write protected. Example
Dim A As Application set A = New Application MsgBox A.ApplicationDirectory
UserProfileDirectory Returns
String
Description This property returns a full path to the personal directory of the current user. Normally return is C:\Documents and Settings\user name\ for Windows XP and C:\Users\user name\ for Windows Vista and subsequent operating systems where user name is a name of a logged in user. Standard subdirectories of this directory Documents, Pictures and others are commonly used to save user's documents, pictures and other similar files. Example
' Writing text file. ' For Windows XP ' "My documents" should be used instead of "Documents" Dim A As Application Set A = New Application Open A.UserProfileDirectory() & "Documents\t.txt" For Output As 1 Print #1, "Hello! Close 1
PublicDirectory Returns
String
Description This property returns a full path to the common directories of all users. Normally return is C:\Documents and Settings\All Users\ for Windows XP and C:\Users\Public\ for Windows Vista and subsequent operating systems. Standard subdirectories of this directory Documents, Pictures and others are commonly used to save common documents, pictures and other similar files. Example
' Writing text file Dim A As Application Set A = New Application Open A.PublicDirectory() & "Documents\t.txt" For Output As 1 Print #1, "Hello, all!" Close 1
TemporaryDirectory Returns
String
Application
Page 2-7
Description This property returns a full path to the directory of the current user used for temporary files. Normally return is C:\Documents and Settings\user name\Local Settings\Temp\ for Windows XP and C:\Users\user name\AppData\Local\Temp\ for Windows Vista and subsequent operating systems where user name is a name of a logged in user. Files stored to this directory are deleted when the operating system clears temporary files. Example
' Writing temporary text file Dim A As Application Set A = New Application Open A.TemporaryDirectory() & "t.txt" For Output As 1 Print #1, "Nothing valuable." Close 1
PythagorasLocalDirectory Returns
String
Description This property returns a full path to the directory where work files of Pythagoras reside such as style library, macro library and others. Normally return is C:\Documents and Settings\user name\Local Settings\ Application Data\Pythagoras\ for Windows XP and C:\Users\user name\AppData\Local\Pythagoras\ for Windows Vista and subsequent operating systems where user name is a name of a logged in user. Example
' Copying macro library file Dim A As Application Set A = New Application FileCopy A.PythagorasLocalDirectory() & "Pythagor.mlb", _ "F:Pythagor.mlb"
CodeDescriptionFile Returns
String
Description This property returns the complete name of the Code Description File (CDF) that is loaded. Example
Dim A As Application set A = New Application MsgBox A.CodeDescriptionFile
HiliteSelections Returns
Boolean
Description This property sets or resets the hiliting of the selected objects. When the user does any operation that stops hiliting, this property becomes FALSE. Many actions, also calling a macro, stops hiliting. Example
Dim A As Application set A = New Application A.HiliteSelections = True
SystemClipboard Parameters
String
Application
Page 2-8
Description SystemClipboard reads text from, or writes text on the Windows or Macintosh clipboard. When writing, other information of the clipboard is lost. Example
A.SystemClipboard = "Put this text on the clipboard" MgsBox A.SystemClipboard
SystemDate Returns
String
Description SystemDate returns the date. The format will depend on the settings of the date format of the Windows or Macintosh system. Alternative for this property : Date. See "Pythagoras VBA language elements", section "Date Functions". Example
MsgBox A.SystemDate
AreaAnnotationFormat Returns
Integer
Description AreaAnnotationFormat sets or returns the format used by the Annotation Tool "Polygon Area". The value is either ptDefaultAreaFormat, ptAcres or ptHaAreCa. Example
A.AreaAnnotationFormat = ptAcres
SystemParameters Returns
SystemParameters
Description Returns or sets the actual system parameters. The system parameters are a set of variables that need to be used only in a few rare cases. In future versions of Pythagoras, new items will be added to the record structure SystemParameters. Before modifying a system parameter, you must first read the actual parameters, and subsequently modify the field concerned. For a description of the Pythagoras data type SystemParameters see the Chapter 122 - Pythagoras Data Types. Example
Dim A As Application Dim SystemPars As SystemParameters Set A = New Application SystemPars = A.SystemParameters ' Read all parameters SystemPars.DWGExportAttribs = False ' Change one parameter A.SystemParameters = SystemPars ' Write all parameters ' Only the parameter DWGExportAttribs will be affected.
IgnoreDataErrors Returns
Boolean
Description This property controls the behaviour of the program when an attempt is made to change a table property or a column property and the new property value contradicts to existing data in the table If IgnoreDataErrors = False (initial setting), then an error is generated. If IgnoreDataErrors = True, the program tries to change data or other property values correspondingly.
Application
Page 2-9
The default value of this property = False. When IgnoreDataErrors = True, the following data or properties changes may take place: a) Type of column is changed and some data cannot be converted: data becomes NULL if such values are not prohibited; b) Minimum or Maximum is changed and some data value contradicts this: contradicting values are changed to Minimum or Maximum correspondingly; c) Other column property (ObjectTypes, ReferencedColumn, PendingAction) is changed so that data becomes invalid: data becomes NULL if such values are not prohibited; d) Table ObjectTypes property is changed and one or more CAD objects linked with the table have a type not included in the new ObjectTypes: CAD object is unlinked from the table and the corresponding row is removed from the table. Example
Dim A As Application Set A = New Application A.IgnoreDataErrors = True
NilUUID Returns
UUID
NegativeInfinity Returns
Double
Description This property returns the special real value (negative infinity). Example
Dim A As Application, X As Double X = A.NegativeInfinity
PositiveInfinity Returns
Double
Description This property returns the special real value + (positive infinity). Example
Dim A As Application, X As Double X = A.PositiveInfinity
NaN Returns
Double
Description This property returns the special real value NaN (not a number). Application
Page 2-10
Example
Methods
NewToolbarButton Parameters
TooltipText As String, MacroName As String, IconSpec As Variant, Enabled As Boolean, ButtonIndex As Long
Description Creates a new button in the toolbar. TooltipText is the tooltip given with this button. MacroName : is the name of the macro to be executed when the button is clicked. IconSpec : can be a Long value for an icon number that indicates the type of icon used (ptMacroIcon_1 .. ptMacroIcon_9, ptMacroIcon_A .. ptMacroIcon_Z, ptMacroIcon_Next, ptMacroIcon_Previous). Or it can be a string value specifying a custom icon file path. In this case an icon file can be specified by passing the full path or by the file name without path and extension. In the latter case it is a user responsibility to place the corresponding icon file with extension .ICO in the subdirectory ICONS \MACROS of Pythagoras installation directory. The icon file must be in the format of 24bit with alpha channel. If Enabled is set to TRUE, the button is enabled. On return the variable ButtonIndex contains a unique identifier. This identifier can eventually be used to do enable or disable the toolbar button. Example
Dim A As Application Dim ButtonIndex As Long set A = New Application A.NewToolbarButton "Calculate", "MyFunction", ptMacroIcon_A, True, ButtonIndex
RemoveToolbarButtons Parameters
None
EnableToolbarButton Parameters
ButtonIndex As Long, Enable As Boolean
Description Enables or disables the toolbar button with given index. Example
A.EnableToolbarButtons ButtonIndex, FALSE
NewUserMenu Parameters
MenuName As String
Description Creates a new User Menu. MenuName is the title of the menu. The maximum number of items in the User menu is 27. The maximum number of items in a submenu is 32. The maximum length of a menu name is 32 characters. Application
Page 2-11
Example
Dim A As Application set A = New Application A.NewUserMenu "My Menu" A.NewUserMenu "My Menu"
RemoveUserMenu Parameters
None
AppendUserMenuItem Parameters
MenuName As String, Enabled As Boolean, Checked As Boolean, MacroName As String, MenuId As Long
Description Appends a User Menu Item to an existing user menu. MenuName : is the name of the User Menu Item. If MenuName is an empty string, a separator is inserted. MacroName: is the name of the macro to be executed when the item is selected. If the macro with the given name does not exist, an error is raised unless the MenuName is an empty string. If Enabled is set to TRUE, the item is enabled (selection possible). If Checked is set to TRUE, the menu item is checked. On return the variable MenuId contains a unique identifier. This identifier can eventually be used to do operations on the menu item. E.g. remove or disable a menu item. Example
Dim A As Application Dim MenuId1 As LONG set A = New Application A.NewUserMenu "My Menu" A.AppendUserMenuItem "Item 1", TRUE, FALSE, "MyFunction", MenuId1
AppendUserPopupMenuItem Parameters
MenuName As String, Enabled As Boolean, MenuId As Long
Description Creates a menu item with makes it possible to create submenus. On return the variable MenuId contains a unique identifier. This identifier must be used to create a submenu item. MenuId can also be used to do other operations on the menu item. E.g. remove or disable the menu item. Example
Dim A As Application Dim MenuId1 As Long, MenuId2 As Long, MenuId3 As Long set A = New Application A.NewUserMenu "My Menu" A.AppendUserMenuItem "Menu item 1", TRUE, FALSE, "MacroItem1", MenuId1 A.AppendUserMenuItem "Menu item 2", TRUE, TRUE, "MacroItem2", MenuId2 A.AppendUserPopupMenuItem "Menu item 3", TRUE, MenuId3
Application
Page 2-12
AppendUserSubMenuItem Parameters
MenuId As Long, MenuName As String, Enabled As Boolean, Checked As Boolean, MacroName As String, SubMenuId As Long
Description Appends a menu item in a submenu. The value set in Menu sets in which submenu the item has to be placed. MenuId : the menuId returned by AppendUserPopupMenuItem. MenuName : the name of the sub menu. If MenuName is an empty string, a separator is inserted. Enabled : if Enabled is TRUE, the menu item is enabled and can be selected. Checked : if Checked is TRUE, the menu item is checked. MacroName : the name of the macro to be executed when selecting the menu item. If the macro with the given name does not exist, an error is raised unless the MenuName is an empty string. SubMenuId = On return this variable contains a unique identifier. This identifier can eventually be used to do operations on the submenu item. E.g. remove or disable a submenu item. The maximum number of items in a submenu is 32. Example
Dim A As Application Dim MenuId1 As Long, MenuId2 As Long Dim SubMenuId1 As Long, SubMenuId2 As Long set A = New Application A.NewUserMenu "My Menu" A.AppendUserMenuItem "Menu Item 1", TRUE, FALSE, "MacroItem1", MenuId1 A.AppendUserPopupMenuItem "Menu Item 2", TRUE, MenuId2 A.AppendUserSubMenuItem MenuId2, "Submenu Item 1", TRUE, FALSE, "MacroSM1" SubMenuId1 A.AppendUserSubMenuItem MenuId2, "Submenu Item 2", TRUE, FALSE, "MacroSM2", SubMenuId2
RemoveUserMenuItem Parameters
MenuId As Long
Description Removes the specified menu item from the User Menu. MenuId has to be a value returned by AppendUserMenuItem or AppendUserPopupMenuItem Example
Dim A As Application Dim MenuId As Long Set A = New Application A.RemoveUserMenuItem MenuId
RemoveUserSubMenuItem Parameters
MenuId As Long, SubMenuId As Long
Description Removes a submenu item. MenuId and SubMenuId define the submenu to be deleted. See also: "AppendUserSubMenuItem" Example
Dim A As Application Dim MenuId1 As Long, SubMenuId1 As Long Set A = New Application A.RemoveUserSubMenuItem MenuId1, SubMenuId1
Application
Page 2-13
EnableUserMenuItem Parameters
MenuId As Long, SubMenuId As Long, Enabled As Boolean
Description Enables or disables a menu item or a submenu item. MenuId : the menu id returned by AppendUserMenuItem. SubMenuId : the sub menu Id returned by AppendUserPopupMenuItem. If SubMenuId = ptNilUserMenuIndex, then the MenuItem is enabled or disabled. Else the item of a submenu is disabled. Enabled : If = TRUE, the menu item or submenu item is enabled and can be selected. Example
Dim A As Application Dim MyMenuId As Long Set A = New Application A.EnableUserMenuItem MyMenuId, ptNilUserMenuIndex, TRUE
CheckUserMenuItem Parameters
MenuId As Long, SubMenuId As Long, Checked As Boolean
Description Sets or removes a check mark. MenuId : the menu id returned by AppendUserMenuItem. SubMenuId : the sub menu Id returned by AppendUserPopupMenuItem. If SubMenuId = ptNilUserMenuIndex, then function applies to the main menu item, else the function applies to the submenu item. Checked : If = TRUE, the menu, or submenu item is checked. Example
Dim A As Application Dim MyMenuId As Long Set A = New Application A.CheckUserMenuItem MyMenuId, ptNilUserMenuIndex, TRUE
OpenDocument Parameters
Name As String, OpenCopy As Boolean, Doc As Document, Optional HandleDataOfSubdocuments As PtSynchronizeDictionaryData := ptDataRaiseError
Description Opens the document. If OpenCopy = TRUE, then a copy of the document is opened. The document window will become the top window and the document will be displayed. If the document is already open, then it will become the top window. A Document object, referring to the open document is returned. If the name is empty, the open dialog box will come up. If the name of a DXF or DWG file is given, the DXF/DWG file will be opened. The DXF / DWG dialog box will come up. Input parameter HandleDataOfSubdocuments defines what to do when the overview document and a subdocument contain a database dictionary table with the same name and structure, but with different datastamps. Data in such tables can differ. See also description of PtSynchronizeDictionaryData enumeration. Value PtDataOfSubdocument should not be used here because it actually means that data from the last opened subdocument will be present in the dictionary table. Value ptDataDontOpenSubdocument may not be specified. Example
Application
Dim Doc As Document Set A = New Application A.OpenDocument "C:\Test.pyt", False, Doc
GetNewDocument Parameters
Doc As Document
Description Opens an Untitled document. The document window will become the top window. Example
Dim Doc As Document Set A = New Application A.GetNewDocument Doc
PutDocumentOnTop Parameters
Doc As Document
GetActiveDocument Parameters
Doc As Document
Description Returns the active document (the document which is on top). Example
Dim Doc As Document Dim A As Application Set A = New Application A.GetActiveDocument Doc
Wait Parameters
Milliseconds As Long
ContinueEvent Parameters
none
Description When ContinueEvent is called when executing an Event Macro, and StopEvent is not called afterwards, then on leaving the Event Macro Pythagoras will still execute the event as if no Event Macro was called. Application
Page 2-15
When an Event Macro does not contain the StopEvent method, ContinueEvent will be taken as default. Calling the method ContinueEvent only makes sense when executing an Event Macro. Example
Dim A As Application A.ContinueEvent
StopEvent Parameters
None
Description When StopEvent is called when executing an Event Macro, and ContinueEvent is not called afterwards, then on leaving the Event Macro Pythagoras will stop processing the event. In other words, StopEvent suppresses the standard behavior of the mouse events. Calling the method StopEvent only makes sense when executing an Event Macro. Example
Public Sub OnMouseDown() Dim A As Application Dim Doc As Document Dim Obj As CadObject Dim P As Point Dim strError As String Dim Sel As Selection Dim T As Text Dim CommentMode As Boolean On Error GoTo ErrorHandle A.GetActiveDocument Doc Doc.GetObjectUnderCursor ptText + ptPoint, Obj If Not (Obj is Nothing) Then If (Obj.ObjectType = ptText) Then Obj.getText T Obj.Color = ptRed A.StopEvent ' If not called, text will be selected. Else If (obj.ObjectType = ptPoint) And Not (T is Nothing) Then Obj.GetPoint P T.color = ptGreen If CommentMode Then P.Comment = T.Content Else P.Elevation = CDBL(T.Content) End If Set T = Nothing A.StopEvent ' If not called, point will be selected. Else Beep End If End If End If ExitHere: Set Doc = Nothing Set Obj = Nothing Exit Sub ErrorHandle: MsgBox Err.Description, vbCritical, strError End Sub 'StopEvent
Application
Page 2-16
SetEventKeys Parameters
NrOfKeys As Integer, Keys() As Long
Description The OnKeyDown and OnKeyUp event macros will only be called when a key in the set Keys is pressed. The value in the array is the virtual key code. The virtual keycodes, of the non-alpha-numberic keys, are predeclared constants. (See section Constants). On Windows, the virtual keycodes for the keys A through Z are 041h - 05Ah. The keys 0 through 9 on the main clipboard have virtual keycodes 030h - 039h. The symbol keys (such as the key with the / and ? symbols), have virtual keycodes of 128 and above, and they are often defined differently on international keyboards. Example
Dim A As Application Dim Keys() As Long Redim Keys(1 To 2) Keys(1) = 100 Keys(2) = 101 A.SetEventKeys 2, Keys
GetEventKeys Parameters
NrOfKeys As Integer, Keys() As Long
Description Returns the set of keys on which the OnKeyDown and OnKeyUp event macros will be called. The value in the array is the virtual key code. (See chapter "Constants", Virtual Key Codes). If any key in the set, the lower bound of the array will be = 1. Example
Dim A As Application Dim Number As Integer Dim Keys() As Long A.GetEventKeys Number, Keys If Number > 0 Then If Keys(1) = 100 Then End If End If
ConvertImage Parameters OrgFile As String, NewFile As String, GeoTiff As Boolean, Pos As XY, Scale As Double, Ok As Boolean Description Converts images (BMP, TIFF, JPEG) to the Pythagoras Image Format (IMG) OrgFile : the filename of the original image NewFile : the filename of the converted IMG image GeoTiff : return parameter. Returns TRUE if the original file is a GeoTIFF file. Only if TRUE, the parameters Pos and Scale will be filled in, otherwise the values will be left unchanged. Pos : Return parameter. Position of the top left corner of the image in the drawing. Only valid if parameter GeoTiff = True. Scale : Return parameter. Scale of the image. Only valid if parameter GeoTiff = True. Ok : Return parameter. If = True, the conversion was successful. Example
Sub ConvertImage Dim Dim Dim Dim A As Application Doc As Document I As Image Drawing As overlay Page 2-17
Application
Pos As XY OrgFile As String NewFile As string GeoTiff As BOOLEAN Ok As BOOLEAN Scale As DOUBLE
Set A = New Application A.GetActiveDocument D D.GetOverlay ptDrawing, Drawing Pos.x = 50 Pos.y = 50 Scale = 0.002 OrgFile = "C:\Test\Test.tif" NewFile = "C:\test.img" A.convertImage OrgFile, NewFile, GeoTiff, Pos, Scale, Ok If Ok Then Drawing.CreateImage NewFile, Pos, GeoTiff, Scale, I I.Color = 180 I.Layer = "Test" I.Displaylevel = -1 I.Intensity = 90 I.Inverted = TRUE I.SetReduce_Enlarge 150.0, 150.0 end If End Sub
GetDocuments Parameters
Docs As Documents
GetSymbolLibrary Parameters
Lib As Library
Description Returns the System Library. This object can be used to obtain information about all symbols, line styles, hatch patterns and typical sections of the System Symbol Library. Note : to obtain the Document Library of a particular document, use the Document method GetSymbolLibrary. (See Document object methods) Example
Sub GetLibrary Dim A As Application Dim L As Library set A = New Application A.GetSymbolLibrary L End Sub
Application
Page 2-18
GetCoordinateReferenceSystems Parameters
CRSs As CoordinateReferenceSystems
Description Returns the Coordinate Reference Systems (CRSs) of the Pythagoras CRS library. Example
Dim A As Application Dim CRSs As CoordinateReferenceSystems Set A = New Application A.GetCoordinateReferenceSystems CRSs
GetTiePointsSetCollection Parameters
TPSC As TiePointsSetCollection
Description Returns the collection of all Tie Points Sets in the Pythagoras library. (stored in .PLB file) Example
Dim A As Application Dim TPSC As TiePointsSetCollection Set A = New Application A.GetTiePointsSetCollection TPSC
GetDialogs Parameters
None
TileWindows Parameters
None
Description Tiles all opened Pythagoras windows. This method is not supported on Apple Macintosh Example
Sub TileWindows Dim A As Application Dim D1 As Document, D2 As Document set A = New Application A.GetActiveDocument D1 A.GetNewDocument D2 A.TileWindows End Sub
Application
Page 2-19
CascadeWindows Parameters
None
Description Cascades the open Pythagoras windows This method is not supported on Apple Macintosh. Example
Sub CascadeWindows Dim A As Application Dim D1 As Document Dim D2 As Document set A = New Application A.GetActiveDocument D1 A.GetNewDocument D2 A.CascadeWindows End Sub
AddToRecentFiles Parameters
FileName As String
Description Adds the file with name FileName to the list of recently opened text files. . Example
Dim A As Application Set A = New Application A.AddToRecentTextFiles "C:\Test.txt"
OpenExternalFile Parameters
FileName As String, Ok As Boolean
Description Opens the file FileName. On MS-Windows, Pythagoras will launch the same application as if the user "double clicked" on the document FileName. On Apple Macintosh, Pythagoras will open the default application of the file type saved in FileName. If on return Ok = False, the file could not be opened. Example
Dim A As Application Dim Ok As Boolean Set A = New Application A.OpenExternalFile "C:\Test.doc", Ok
Description Downloads a file from the given URL and saves the file. The name of the file is given by parameter FileName.
Application
Page 2-20
If on return Result = ptDownloadOk, the file is downloaded and saved. If file could not be downloaded or result not saved the return value is either ptDownloadFailed or ptDownloadAborted. Example
Dim A As Application Dim Result As Long Set A = New Application Result = A.DownloadFile "FTP://[email protected]/test.txt", "C:\Test.txt"
GetPathName Parameters
FullFileName As String, PathName As String
Description Returns a string that contains the full pathname of the file with the given name. Initially FileName must contain a file name with a complete path. Example
Dim A As Application Dim PathName As String Set A = New Application A.GetPathName "C:\Program Files\Pythagoras\Pythagoras.exe", PathName MsgBox PathName ' Will display "C:\Program Files\Pythagoras\"
GetFileName Parameters
FullFileName As String, FileName As String
Description Returns a string that contains only the file name part, without the path, of the file. Example
Dim A As Application Dim FileName As String Set A = New Application A.GetFileName "C:\Program Files\Pythagoras\Pythagoras.exe", FileName MsgBox FileName ' Will display "Pythagoras.exe"
Intersection2Lines Parameters
L1 As Line2D, L2 As Line2D, Pnt As XY, Ok As Boolean
Description Intersection2Lines calculates the intersection of 2 lines. If the lines are parallel, Ok returns False, otherwise Ok = True. Example
Dim Dim Dim Dim A As Application L1 As Line2D, L2 As Line2D Pnt As XY Ok As Boolean
Set A = New Application L1.p1.x = 10.0 L1.p1.y = 10.0 L1.p2.x = 20.0 L1.p2.y = 20.0 L2.p1.x = 10.0 L2.p1.y = 20.0 L2.p2.x = 20.0 L2.p2.y = 10.0 A.Intersection2Lines L1, L2, Pnt, Ok
Application
Page 2-21
Intersection Parameters
O1 As CadObject, O2 As CadObject, Pnt As XY, Ok As Boolean, Optional SecondSolution := False
Description Intersection calculates the intersection of 2 objects. The objects may be a combination of the following object types : Line - Line, Line - Arc, Line - Path and Line - Curve. If there is more then one intersection if the CadObject is a curve, the one closest to the midpoint of the line is returned. In case of Line - Arc and there are 2 solutions, the optional parameter SecondSolution allows to return the second solution. If the objects do not intersect, Ok returns False, otherwise Ok = True. Example
Dim Dim Dim Dim Dim A As Application L As Line, B As Arc O1 As CadObject, O2 As CadObject Pnt1 As XY, Pnt2 As XY Ok As Boolean O1 O2 O1, O2, Pnt1, Ok O1, O2, Pnt2, Ok, SecondSolution:=True
BestLine Parameters
NrOfPoints As Long, Points() As XYZ, L1 As Line3D, Ok As Boolean
Description Calculates a line so that the sum of the squares of the distances of the points to the line is minimal. Example
Dim Dim Dim Dim A As Application L As Line3D Pnts() As XYZ Ok As Boolean
BestArc Parameters
NrOfPoints As Long, Points() As XYZ, _ P1 As XYZ, P2 As XYZ, Center As XY, Ok As Boolean
Description Calculates an arc so that the sum of the squares of the distances of the points to the arc is minimal. Example
Dim Dim Dim Dim A As Application P1 As XYZ, P2 As XYZ, Center As XY Pnts() As XYZ Ok As Boolean
BestCircle Parameters
NrOfPoints As Long, Points() As XYZ, _ Center As XYZ, RadiusPnt As XYZ, Ok As Boolean
Application
Page 2-22
Description Calculates a circle so that the sum of the squares of the distances of the points to the circle is minimal. Example
Dim Dim Dim Dim A As Application Center As XYZ, RadiusPnt As XYZ Pnts() As XYZ Ok As Boolean
Description Calculates the projection of a point on a line. De elevation of the projection point is derived from the elevation of the starting and end point of the line. Example
Dim A As Application Dim L As Line3D Dim Pnt As XY, ProjPnt As XYZ Set A = New Application ProjPnt = A.ProjectionOnLine(L, Pnt)
Description Returns True if the option is supported. Valid options : ptPO_ReadWrite, ptPO_DTM, ptPO_RD, ptPO_DC, ptPO_XL, ptPO_I, ptPO_SICAD, ptPO_DB Example
Dim A As Application Set A = New Application If A.OptionSupported(ptPO_DTM) THEN DTM option is available End If
Application
Page 2-23
Description NameCategory returns one of the following values: ptStrictRegularName, ptRegularName, ptIrregularName, ptInvalidName. - ptStrictRegularName : the safest name containing only Latin letters (A..Z), digits (0..9) and the "_" (underscore). The first character of name is a letter. - ptRegularName: name is regular according SQL92 standard. The name may contain letters and digits of any alphabet and also the characters $ and #. Using such name may cause problems when the database is exported and used in other database applications. - ptIrregularName: name may be used in a Pythagoras database but it is not recommended since it may cause problems when used by other database programs. - ptInvalidName: name may not be used in a Pythagoras database. Example
Dim A As Application Dim TableName As String Set A = New Application If A.NameCategory(TableName) = ptInvalidName THEN Name may not be used End If
RowSetDefinition Parameters
RowSetType As PtRowSetType, Optional Name As Variant = Empty (String or DBQuery), Optional ObjectTypes As Long = 0, Optional Overlay As PtRowSetBaseOverlay = ptCurrentOverlay, Optional SheetName As String = "" RowSetDefinition
Returns
Description This method initializes a variable of type RowSetDefinition. Argument values are assigned to result fields having the same names. Example See class DBQuery method AddDimension MatchCondition Parameters
Kind As PtMatchConditionKind, Page 2-24
Application
Returns
MatchCondition
Description This method initializes a variable of type MatchCondition. Argument values are assigned to result fields having the same names. Example
Dim A As Application Dim Condition As MatchCondition Condition = A.MatchCondition (ptExpression, "main.id = aux.senior")
WhereCondition Parameters
Compare As PtCompare, Optional Column As Variant (PtObjectFunction or String), Optional Value As Variant, Optional ValueType As Byte = vbNull, Optional Aggregation As PtAggregateFunction = ptFunctionNil WhereCondition
Returns
Description This method initializes a variable of type WhereCondition. When Column is of PtObjectFunction type then result field Feature is initialized to this value. When Column is of String type then result field Feature is initialized to ptFunctionEmpty and result field Column is initialized to this value. Column is not necessary when Aggregation = ptCount. Values of other parameters are assigned to result fields having the same names. Parameter Value is not necessary when Compare is ptCompareIsNull, ptCompareIsNotNull, ptCompareIsTrue or ptCompareIsFalse. See also DBQuery.AddWhere method description about ValueType parameter usage. Example See class DBQuery method AddWhere ColumnDefinition Parameters
Name As String, Optional Description As String = "", Optional IsComputed As Boolean = False, Optional RowSet As String = "", Optional Expression As String = "", Optional Aggregation As PtAggregateFunction = ptFunctionNil, Optional Format As String = "", Optional Fractional As Byte = 2 ColumnDefinition
Returns
Description This method initializes a variable of type ColumnDefinition. Argument values are assigned to result fields having the same names. Explicitly or implicitly defined fields of the result value can occasionally be incomplete or contradictory. Nevertheless this method always completes successfully. An error can happen later when such definition will be used. Example See class Database method CreateSimpleQuery. CreateUUID Parameters
no parameters
Application
Page 2-25
Returns
UUID
Description CreateUUID returns a new generated UUID. For more information about UUID see http://en.wikipedia.org/wiki/UUID Example
Dim A As Application Dim Id As UUID Set A = New Application Id = A.CreateUUID()
Description UUIDToString returns a string representation (according OpenGroup standard) of the UUID. Note: the string is not enclosed in braces. Example
Dim A As Application Dim Id As UUID Dim S As String S = A.UUIDToString(Id)
Application
Page 2-26
Description StringToUUID converts a string to a UUID. The method returns False if the string could not be converted to a UUID. Example
Dim A As Application Dim Id As UUID Dim S As String If A.StringToUUID(S, Id) Then ' Converstion to UUID ok End If
Description UUIDToDate returns a date extracted from the UUID. The result is meaningless if the UUID = NilUUID. Example
Dim A As Application Dim Id As UUID Dim D As Date D = A.UUIDToDate(Id)
Parse Parameters
Expression As String, Optional Table As Variant = Empty, Optional ResultType As Byte, Optional ErrorText As String, Optional ErrorStart As Long, Optional ErrorEnd As Long PtSyntaxError
Returns
Description Parse parses Expression. The expression is a string. The syntax is the same as specified for expressions used in the Find-function and Thematic Map of Pythagoras and is described in the Pythagoras reference manual. The method Parse accepts only the international (not localized) version of the language. Table may be of type DBTable or DBQuery. If this value is neither Empty nor Nothing then expression may contain names of columns of the given rowset. Return value is = ptSyntaxSuccess when Expression is a valid expression. If return value = ptSyntaxSuccess then ResultType is the type of the result of the expression: vbLong, vbDouble, vbString, vbBoolean ... ptXY, ptCadObjectType. For Expression = "NULL", ResultType = vbNull is returned. If the return value <> ptSyntaxSuccess, the 3 last parameters will contain more information about the error. ErrorText will contain textual description of the error. ErrorStart and ErrorEnd will contain starting and ending position of the error in Expression. Example
Dim A As Application
Application
Page 2-27
Dim Expr As Expression Dim ErrorMsg As String Dim ExpType As Byte, Start As Long, End As Long If _ A.Parse(Expr, MyTable, ExpType, ErrorMsg, Start, End) _ = ptSyntaxSuccess _ Then If ExpType = vbDouble Then .. Else ' Inform the user that the expression type is wrong End If Else ' Give syntax error End If
Description This method converts a true color RGB value to its nearest color index. If Match = True then the method ColorToTrueColor(Color) will return the same RGB values. If Match = False, the method ColorToTrueColor(Color) will return an approximate value. Example
Dim Dim Dim Dim A As Application Color As Integer TrueColor As RGB Match As Boolean
Description This method returns the true color RGB values of a color index. Example
Dim Dim Dim Dim A As Application Color As Integer TrueColor As RGB Match As Boolean
TrueColor = ColorToTrueColor(Color)
GetUserDefaults Parameters
UDs As UserDefaults
Description This method returns an object of type UserDefaults. This object contains the list of all user defaults.
Application
Page 2-28
Example
Dim App As Application Dim UDs As UserDefaults Set App = New Application App.GetUserDefaults UDs
GetAttributesSet Parameters
Type As Integer, Attribs As AttributesSet
Description This method returns the AttributesSet that corresponds with the requested type. Type = ptSystem : AttributesSet of the System Defaults of Pythagoras. Type = ptDefault : AttributesSet of the Current Defaults of Pythagoras. Type = ptUserDefault : AttributesSet of the Current Defaults overwritten by the User Defaults. If the attributes in case Type = ptUserDefault are used, creating a CadObject with the styles defined in AttributesSet, will give the same attributes as if the CadObject was created interactively in Pythagoras. Example
Dim A As Application Dim Attribs As AttributesSet A.GetAttributesSet ptUserDefault, Attribs
SetVBADefaultAttributes Parameters
Type As Integer
Description This method defines which attributes are used when a CadObject is created by VBA. When creating a new CadObject and Type has been set to: ptSystem : the System Default attributes of Pythagoras are used. ptDefault : the Current Defaults of Pythagoras are used. ptUserDefault : the Current Defaults overwritten by the User Defaults are used. When this method has not been called the default attributes correspond with ptUserDefault. This setting remains only valid till a macro is terminated after termination the default attributes will be set to ptUserDefault.As a consequence, a VBA program that always wants to create objects using System Defaults, should always call this method before starting to create objects. Example
Dim A As Application A.SetVBADefaultAttributes ptSystem
Description This method converts a UTF-8 coded string in Sourceto the current locale ASCII one and stores it to Dest. UTF-8 characters that cannot be represented in the current locale ASCII are replaced either by the most similar characters or by question marks. Returned value is True when conversion is successful. Conversion is impossible when an input string does not comply with UTF-8 format.
Application
Page 2-29
Current locale strings are used in most Pythagoras VBA properties and methods; UTF-8 coded strings are used in XML interface properties and methods. Example
Dim A As Application, Element As XMLElement, Name As String If A.UTF8ToASCII (Element.Name, Name) Then MsgBox "Element name is " & Name Else MsgBox "Element name is not a correct UTF-8 string" End If
Description This method converts a UTF-8 coded string in Sourceto the current locale ASCII one and returns it. UTF-8 characters that cannot be represented in the current locale ASCII are replaced either by the most similar characters or by question marks. Returned value is Error when aninput string does not comply with UTF-8 format. Current locale strings are used in most Pythagoras VBA properties and methods; UTF-8 coded strings are used in XML interface properties and methods. Example
Dim A As Application, Element As XMLElement MsgBox "Element name is " + A.UTF8ToASCIIV (Element.Name) ' An error will be signaled ' if Element.Name is not a correct UTF-8 string
Description This method converts a string from the current locale ASCII to UTF-8 one and returns it. Current locale strings are used in most Pythagoras VBA properties and methods;UTF-8 coded strings are used in XML interface properties and methods. Example
Dim A As Application, Element As XMLElement Element.Name = A.ASCIIToUTF8 ("") ' A Ukrainian word meaning "File", ' it is assumed that this example is working ' when current locale is Cyrillic
Application
Page 2-30
Example
Dim A As Application, X As Double If Not A.IsNegativeInfinity(X) And A.IsPositiveInfinity(X) And Not A.IsNaN(X) Then ' We are here if X is a finite real value ' . . . End If
Description These methods return True when Source is any kind of not-a-number. Example
See Application.IsInfinity
SortAll Parameters
Values() As Variant, Optional Ascending As Boolean = True, Optional StringSortType As Integer = ptSortAlphaNumerical
Description This method will sort all values in the array in ascending (default) or descending order. The allowed subtypes of value are: Integer, Long, Single, Double, String, Boolean and Date. All values should be of the same subtype. If the subtype of the Values = String, the optional parameter StringSortType is either ptSortAlphaNumerical or ptSortAlphabetical (default sorting).
Application
Page 2-31
ptSortAlphaNumerical: this sorting corresponds with the way Windows sorts file names in Windows Explorer: ABC30 > ABC4. The string may contain a mixure of numerical an alpha parts. ptSortAlphabetical.: this is pure alphabetical sorting: ABC30 < ABC4. If one of the above conditions is not satisfied, the error 1522, "An actual variant argument has improper type", will be raised. Example
Dim App As Application Dim V() As Variant Set App = New Application Redim V(1 To 5000) ' Fill array App.SortAll V
Sort Parameters
Values() As Variant, Count As Long, Optional Ascending As Boolean = True, Optional StringSortType As Integer = ptSortAlphaNumerical
Description This method will sort the first n values in ascending (default) or descending order. The number (n) is given by the parameter Count. If Count is larger than the size of Values, the error 1501: "Invalid Parameter" will be raised. See also the method SortAll. Example
Dim App As Application Dim V() As Variant Set App = New Application Redim V(1 To 5000) ' Fill array App.Sort V, 200, False
SortValueIndex Parameters
Data() As ValueIndex, Count As Long, Optional Ascending As Boolean = True, Optional StringSortType As Integer = ptSortAlphaNumerical
Description This method will sort the first n values of array data in ascending (default) or descending order of the field value. See also the method SortAll. Example
Type AddressBook Name As String Street As String Number As Integer ZipCode As String End Type Dim R(1 TO 50) As AddressBook Dim R2(1 TO 50) As AddressBook Dim D(1 TO 50) As ValueIndex Set App = New Application For i = LBound(R) to UBound(R) D(i).Value = R(i).Name D(i).Index = i Next i App.SortValueIndex D, 50 ' Not sorted addressbook ' Sorted addressbook ' See Pythagoras Data Types
Application
Page 2-32
IncPointIdent Parameters
PointIdent As String, Optional AlphaIncrement As Boolean = False
Description This method increments PointIdent. This parameter is considered to be a point number. Incrementing the value behaves as the autoincrement of the point number in Pythagoras. If the parameter AlphaIncrement = True, passing a string that does not contain numeric characters will be alphabetically incremented. E.g. A will become B. Example
Sub PM_Test Dim A As Application Dim PntId As String Set A = New Application PntId = "A" A.IncPointIdent PntId, True PntId = "A01" A.IncPointIdent PntId End Sub
InitSelectionCriteria Parameters
SelCriteria As SelectionCriteria
Description This method initialises SelectionCriteria. All fields of SelectionCriteria will be set to there default values which for most = binary value 0. In VBA the binary value 0 will make booleans = 0. Exception: SelectionCriteria.Objects = ptAll. Every time a new variable SelectionCriteria is used, the VBA program should call this method. Example
Sub PM_Test Dim A As Application Dim SelCriteria As SelectionCriteria Set A = New Application A.InitSelectionCriteria SelCriteria SelCriteria.Objects = ptPoint SelCriteria.OnLayer = True SelCriteria.Layer = VBA Layer A.InitSelectionCriteria SelCriteria End Sub
Description This method returns the value entered in the console window. This method is reserved for debugging a VBA application. The console window is only present in a special VBA Debug version of Pythagoras. Example
Sub PM_Message
Application
Page 2-33
Set A = New Application A.DebugOutput "Give number of values : " Count = CInt(A.DebugInput) A.DebugOutput vbCrLf For i = 1000 TO 1000 + Count A.DebugOutput "i = " & CStr(i) & vbCrLf Next i A.DebugOutput "Press Enter key " S = A.DebugInput A.DebugOutput "Thank you for pressing Enter key" & vbCrLf A.DebugOutput "Press Enter key " S = A.DebugInput A.DebugOutput "Thank you for pressing Enter key" & vbCrLf End Sub
DebugOutput Parameters
String
Description This method writes the string to the console window. This method is reserved for debugging a VBA application. The console window is only present in a special VBA Debug version of Pythagoras. Example See example DebugInput
XML Methods
CreateXMLDocument Parameters Returns
Name As String XMLDocument
Description Creates and returns a new empty XML document with the main element having the specified. If Name is invalid then Nothing is returned. Example
Const eAcute = Chr(&HC3)+Chr(&HA8) ' Small Latin e whith acute in UTF-8 Dim A As Application, Doc As XMLDocument Dim Region As XMLElement, Province As XMLElement Sub AddProvince (ByVal Name As String, _ ByVal Capital As String, ByVal Population As Long, _ ByVal Languages As String) Set Province = Region.SubItems.AddElement ("province") Province.AddAttribute "name", Name Province.AddAttribute "capital", Capital Province.AddAttribute "population", _ A.XMLIntegerToString(Population) Province.AddAttribute "language", Languages End Sub
Application
Page 2-34
Sub PM_CreateBelgiumXMLFile Dim Comment As XMLComment Set A = New Application Set Doc = A.CreateXMLDocument ("country") Doc.Version = xmlv1_0 Doc.Main.AddAttribute "name", "Belgium" Doc.Main.AddAttribute "capital", "Brussels" Doc.Main.AddAttribute "censusDate", _ A.XMLDateToString (#2010-01-01#) Doc.Main.AddAttribute "population", "10839905" Doc.Main.AddAttribute "language", "DEU DUT FRA" Set Region = Doc.Main.SubItems.AddElement ("region") Region.AddAttribute "name", "Brussels Capital region" Region.AddAttribute "population", "1083538" Region.AddAttribute "language", "DUT FRA" Set Comment = _ Region.SubItems.AddComment ( _ "the region is not divided to provinces, and often " & _ "is recognized as a province" _ ) Set Region = Doc.Main.SubItems.AddElement ("region") Region.AddAttribute "name", "Flemish region" Region.AddAttribute "capital", "Brussels" Region.AddAttribute "population", "6251983" Region.AddAttribute "language", "DUT" AddProvince "Antwerp" , "Antwerp", 1744862, "DUT" AddProvince "East Flanders" , "Ghent" , 1432326, "DUT" AddProvince "Flemish Brabant", "Leuven" , 1076924, "DUT" AddProvince "Limburg" , "Hasselt", 838505, "DUT" AddProvince "West Flanders" , "Bruges" , 1159366, "DUT" Set Region = Doc.Main.SubItems.AddElement ("region") Region.AddAttribute "name", "Wallon region" Region.AddAttribute "capital", "Namur" Region.AddAttribute "population", "3498384" Region.AddAttribute "language", "DEU FRA" Set Comment = _ Region.SubItems.AddComment ( _ "the region is also called Wallonia") AddProvince "Hainaut" , "Mans" , 1309880, "FRA" AddProvince "Wallon Brabant", "Wavre" , 379515, "FRA" AddProvince "Li"&eAcute&"ge", "Li"&eAcute&"ge", 1067685, _ "DEU FRA" AddProvince "Luxembourg", "Arlon", 269023, "FRA LTZ" AddProvince "Namur" , "Namur", 472281, "FRA" If Doc.Save ("c:\Belgium.xml", MaxLine:=68) <> xmlcSuccess Then MsgBox "XML document cannot be written" End If End SubDim A As Application
Application
Page 2-35
recognized as a province --> </region> <region capital="Brussels" language="DUT" name="Flemish region" population="6251983" > <province capital="Antwerp" language="DUT" name="Antwerp" population="1744862" /> <province capital="Ghent" language="DUT" name="East Flanders" population="1432326" /> <province capital="Leuven" language="DUT" name="Flemish Brabant" population="1076924" /> <province capital="Hasselt" language="DUT" name="Limburg" population="838505" /> <province capital="Bruges" language="DUT" name="West Flanders" population="1159366" /> </region> <region capital="Namur" language="DEU FRA" name="Wallon region" population="3498384" > <!-- the region is also called Wallonia --> <province capital="Mans" language="FRA" name="Hainaut" population="1309880" /> <province capital="Wavre" language="FRA" name="Wallon Brabant" population="379515" /> <province capital="Lige" language="DEU FRA" name="Lige" population="1067685" /> <province capital="Arlon"
Application
Page 2-36
language="FRA LTZ" name="Luxembourg" population="269023" /> <province capital="Namur" language="FRA" name="Namur" population="472281" /> </region> </country>
ReadXMLDocument Parameters
FullFilename As String, Optional ReadComments As Boolean = False, Optional ReadPI As Boolean = False, Optional Completion As XMLCompletionCode, Optional Line As Long, Optional Column As Long XMLDocument
Returns
Description The method opens the specified file together with possible referenced files, creates an empty XML document, fills it by information read from files and returns the created document. If File was not successfully read the Nothing is returned. Parameter FullFileName may be either a full path to a local file or an absolute URL to the file in the Web. Parameters ReadComments and ReadPI define whether comments and PIs correspondingly will be stored to the new document. Parameter Completion will contain code of error in case of failure, or xmlcSuccess in case of success. Parameters Line and Column may contain information about position where an error was encountered during reading. Numerations of lines and positions start from 1. If an error was encountered analyzing an embedded internal or external entity or an external DTD, additional information about position of the error can be obtained calling GetXMLErrorPosition method. Example See example XMLDocument GetXMLErrorPosition Parameters Returns
Position() As Location Boolean
Description This method returns additional information about error position during the last execution of ReadXMLDocument method. If the error was found not in an embedded entity then returned value will be False and Position will be empty. Otherwise returned value will be True and Position will contains as many elements as many embedded levels were at the moment when the error was found. Field Entity of each array element will contain the following information: %name; for a parameter internal entity where name is a name of the entity &name; for a parsed internal entity where name is a name of the entity an absolute URL for an external entity Example See example XMLDocument Application
Page 2-37
XMLReplaceWhites Parameters
S As String
Description Replaces all white characters (<SP>, <HT>, <LF> and <CR>) in S with blanks (<SP>). This action is one of the white space normalization operations described in the XML standard. Example
Dim A As Application Dim S As String A.XMLReplaceWhites S
XMLCollapseWhites Parameters
S As String
Description Leading and trailing white characters (<SP>, <HT>, <LF> and<CR>) in Sare eliminated and consecutive whites are replaced by blanks (<SP>). This action is one of the white space normalization operations described in the XML standard. Example
Dim A As Application, Dim S As String A.XMLCollapseWhites S
XMLWhiteSpaceNormalize Parameters
S As String, WhiteSpace As XMLWhiteSpaceFacet
Description String S is normalized accordingly to the XML standard and correspondingly to WhiteSpace value: xmlPreservenothing is done. xmlReplaceas XMLReplaceWhites method does. xmlCollapseas XMLCollapseWhites method does. Example
Dim A As Application Dim S As String, Dim Element As XMLElement A.XMLWhiteSpaceNormalize S, Element.WhiteSpace
Description This method converts an Expression value to Boolean type accordingly to the XML standard. If input value is wrong, Error is returned. Note that unlike standard VBA function CBool white space characters being both at the beginning or at the end of an input strings are ignored. Example
Dim A As Application Dim S As String, B As Boolean B = A.XMLStringToBoolean (S)
Application
Page 2-38
Description This method converts an Expression value to Long type accordingly to the XML standard. If input value is wrong, Error is returned. Note that unlike standard VBA function CLong white space characters being both at the beginning or at the end of an input strings are ignored. Example
Dim A As Application Dim S As String, L As Long L = A.XMLStringToInteger (S)
Description This method converts an Expression value to Double type accordingly to the XML standard assuming XML standard type decimal for an input value (integer and optional fraction parts separated by a dot and possible white characters at the beginning and the end). If input value is wrong, Error is returned. Example
Dim A As Application Dim S As String, D As Double D = A.XMLDecimalStringToReal (S)
Description This method converts an Expression value to Double type accordingly to the XML standard assuming XML standard type double for an input value (scientific notation and special values accordingly to IEEE764 standard plus possible whites at the beginning and the end). If input value is wrong, Error is returned. Example
Dim A As Application Dim S As String, D As Double D = A.XMLDecimalStringToReal (S)
XMLStringToDateTime Parameters
Expression As String Optional Zone As Variant (Integer) Variant (Date)
Returns
Description These method converts an Expression value to Date type accordingly to the XML standard. If input value is wrong, Error is returned. Application
Page 2-39
Returned value is local date/time as it is stored in the input string. Zone obtains value of a time zone expressed as number of minutes which the local time differs by from the UTC (positive for the East hemisphere). If zone part is not present in the input string, Zone obtains value Empty. Example
Dim A As Application Dim S As String, T As Variant, Z As Variant T = A.XMLStringToDateTime (S,Z) If IsError (T) Then MsgBox "Time is incorrect" Else MsgBox "Time Is " & Hour(T) & ":" & Minute(T) If IsEmpty (Zone) Then MsgBox "Time zone is not defined" Else MsgBox "Time difference from UTC is " & Zone & " minutes" End If End If
XMLStringToTime Parameters
Expression As String Optional Zone As Variant (Integer) Variant (Date)
Returns
Description These methodsconvert an Expression value to Date type accordingly to the XML standard. If input value is wrong, Error is returned. Returned value is local time as it is stored in the input string. Zone obtains value of a time zone expressed as number of minutes which the local time differs by from the UTC (positive for the East hemisphere). If zone part is not present in the input string, Zone obtains value Empty. Example
See XMLStringToDateTime
XMLStringToDate Parameters
Expression As String Optional Zone As Variant (Integer) Variant (Date)
Returns
Description These methodsconvert an Expression value to Date type accordingly to the XML standard. If input value is wrong, Error is returned. Returned value is local date as it is stored in the input string. Zone obtains value of a time zone expressed as number of minutes which the local time differs by from the UTC (positive for the East hemisphere). If zone part is not present in the input string, Zone obtains value Empty. Example
See XMLStringToDateTime
Application
Page 2-40
Description These methodsconvert an Expression value to Date type accordingly to the XML standard. Returned value is UTC date/time. If input value is wrong or does not contain a zone part Error is returned. Example
Dim A As Application Dim S As String, T As Variant T = A.XMLStringToUTCDateTime (S) If IsError (T) Then MsgBox "UTC time is unknown" Else MsgBox "UTC time Is " & Hour(T) & ":" & Minute(T) End If
Description These methodsconvert an Expression value to Date type accordingly to the XML standard. Returned value is UTC time. If input value is wrong or does not contain a zone part Error is returned. Example
See XMLStringToUTCDateTime
XMLDivideString Parameters
Expression As String, Values() As String
Description Expression value is divided to substrings treating white characters (in sense of XML standard) as separators and result is stored to Values. The operation is a routine operation for XML array data to obtain elements of arrays. Values may become empty. Example
Dim A As Application Dim Element As XMLElement, Values() As String A.XMLDivideString Element.Value, Values MsgBox UBound(Values)+1 & " values are present" ' Note : ' this example will not work properly when there are 0 values
Description This method first of all divides Expression content to several strings as XMLDivideString method does. Then each obtained string is converted to Boolean type as XMLStringToBoolean method does. If any of conversions is impossible, False is returned and Values becomes empty. Example
Dim A As Application Dim Element As XMLElement, Values() As Boolean, OK As Boolean OK = A.XMLStringToBooleans (Element.Value, Values)
Application
Page 2-41
Description This method first of all divides Expression content to several strings as XMLDivideString method does; then each obtained string is converted to Longtype as XMLStringToInteger method does. If any of conversions is impossible, False is returned and Values becomes empty. Example
Dim A As Application Dim Element As XMLElement, Values() As Long, OK As Boolean OK = A.XMLStringToIntegers (Element.Value, Values)
Description Each of these methodsfirst of all divides Expression content to several strings as XMLDivideString method does. Then each obtained string is converted to Realtype as corresponding method XMLDecimalStringToRealdoes. If any of conversions is impossible, False is returned and Values becomes empty. Example
Dim A As Application Dim Element As XMLElement, Values() As Double, OK As Boolean OK = A.XMLDecimalStringToReals (Element.Value, Values)
Description This methodfirst of all divides Expression content to several strings as XMLDivideString method does. Then each obtained string is converted to Realtype as corresponding method XMLStringToReal does. If any of conversions is impossible, False is returned and Values becomes empty. Example
Dim A As Application Dim Element As XMLElement, Values() As Double, OK As Boolean OK = A.XMLStringToReals (Element.Value, Values)
XMLStringToDateTimesZ Parameters
Expression As String, Values() As Date, Zones() As Variant (Integer) Boolean
Returns
Application
Page 2-42
Description Each of these methods first of all divides Expression content to several strings as XMLDivideString method does. Then each obtained string is converted to a pair of values of Date and Integer types as corresponding method XMLStringToDateTimedoes. If any of the conversions is impossible, False is returned and both Values and Zones become empty. Example
Dim A As Application Dim Element As XMLElement, Values() As Date, Zones() As Variant Dim OK As Boolean OK = A.XMLStringToDateTimesZ (Element.Value, Values, Zones)
XMLStringToTimesZ Parameters
Expression As String, Values() As Date, Zones() As Variant (Integer) Boolean
Returns
Description Each of these methods first of all divides Expression content to several strings as XMLDivideString method does. Then each obtained string is converted to a pair of values of Dateand Integer types as corresponding method XMLStringToTime does. If any of the conversions is impossible, False is returned and both Values and Zones become empty. Example
See XMLStringToDateTimesZ
XMLStringToDatesZ Parameters
Expression As String, Values() As Date, Zones() As Variant (Integer) Boolean
Returns
Description This method first of all divides Expression content to several strings as XMLDivideString method does. Then each obtained string is converted to a pair of values of Date and Integer types as corresponding method XMLStringToDate does. If any of the conversions is impossible, False is returned and both Values and Zones become empty. Example
See XMLStringToDateTimesZ
Application
Page 2-43
Description The same methods as XMLStringToDateTimes but converted to UTC values. Note that omitted time zone in one or more values is treated as error. Example
Dim A As Application Dim Element As XMLElement, Values() As Date, OK As Boolean OK = A.XMLStringToUTCDateTimes (Element.Value, Values)
Description The same methods as XMLStringToDates but converted to UTC values. Note that omitted time zone in one or more values is treated as error. Example
See XMLStringToUTCDateTimes
Application
Page 2-44
Note. The method differs from standard VB function CString function in that that this method returns values in lower case. Example
Dim A As Application Dim Element As XMLElement, Value As Boolean Element.AddText A.XMLBooleanToString (Value)
Description This method returns Source value converted to string. Note. The method does exactly the same as standard VB function CString function does. It is included to Pythagoras VBA only for completeness reason. Example
Dim A As Application Dim Element As XMLElement, Value As Long Element.AddText A.XMLIntegerToString (Value)
XMLRealToDecimalString Parameters
Source As Double Optional Fractional As Integer = 6 String
Returns
Description This method returns Source value converted to string correspondingly to XML standard type decimal with specified number of fractional digits, i.e. an optional sign, an integer part, a dot and a fractional part. Example
Dim A As Application Dim Element As XMLElement, Value As Double Element.AddText A.XMLRealToDecimalString (Value, 4)
XMLRealToString Parameters
Source As Double, Optional Fractional As Integer = 6, Optional Exponential As Boolean = True String
Returns
Description This method returns Source value converted to string correspondingly to XML standard type double with specified number of fractional digits. This method with parameter Exponential = False differs from the previous one only in that that special values such as infinity are converted to special strings. When Exponential = False resulting string will have an exponential part (power of ten). Example
Dim A As Application Dim Element As XMLElement, Value As Double Element.AddText A.XMLRealToString (Value, 5)
Application
Page 2-45
XMLDateTimeToString Parameters
Source As Date, Optional Zone As Integer, Optional Fractional As Integer = 0 String
Returns
Description This method returns Source value converted to string correspondingly to the XML standard. Fractional defines how many fractional digits of seconds to store. If Zone is present it defines a time zone expressed as difference with UTC time expressed as number of minutes (positive for the East hemisphere). If Zone is omitted then a zone part is not stored. Example
Dim A As Application Dim Element As XMLElement, Value As Date Element.AddText A.XMLDateTimeToString (Value)
XMLTimeToString Parameters
Source As Date, Optional Zone As Integer, Optional Fractional As Integer = 0 String
Returns
Description This method returns Source value converted to string correspondingly to the XML standard. Fractional defines how many fractional digits of seconds to store. If Zone is present it defines a time zone expressed as difference with UTC time expressed as number of minutes (positive for the East hemisphere). If Zone is omitted then a zone part is not stored. Example
See XMLDateTimeToString.
XMLDateToString Parameters
Source As Date Optional Zone As Integer String
Returns
Description This method returns Source value converted to string correspondingly to XML standard. Zone is processed in the same way as for XMLDateTimeToString method. Example
Dim A As Application Dim Element As XMLElement, Value As Date Element.AddText A.XMLDateToString (Value)
Description This method differs from XMLDateTimeToString method only in that that input time is rather UTC than local.
Application
Page 2-46
Example
Dim A As Application Dim Element As XMLElement, Value As Date Element.AddText A.XMLUTCDateTimeToString (Value, 60) ' store as Central Europe time
Description This methods differs from XMLTimeToString method only in that input time is rather UTC than local. Example
See XMLUTCDateTimeToString
Description This method returns all strings united together by a space character. This is a normal way to make an array value for an XML file. Example
Dim A As Application Dim Element As XMLElement, Values() As String Element.AddText A.XMLUniteStrings (Values)
Description This method converts all values in Source to strings as method XMLBooleanToString does. Then it returns a united value as XMLUniteStrings method does. Example
Dim A As Application Dim Element As XMLElement, Values() As Boolean Element.AddText A.XMLBooleansToString (Values)
Description This method converts all values in Source to strings as method XMLIntegerToString does. Then it returns a united value as XMLUniteStrings method does. Example
Dim A As Application
Application
Page 2-47
Description This method converts all values in Source to strings as method XMLRealToDecimalString does. Then it returns a united value as XMLUniteStrings method does. Example
Dim A As Application Dim Element As XMLElement, Values() As Double Element.AddText A.XMLRealsToDecimalString (Values, 0)
XMLRealsToString Parameters
Source() As Double, Optional Fractional As Integer = 6, Optional Exponential As Boolean = True String
Returns
Description This method converts all values in Source to strings as method XMLRealToString does. Then it returns a united value as XMLUniteStrings method does. Example
Dim A As Application Dim Element As XMLElement, Values() As Double Element.AddText A.XMLRealsToString (Values)
Returns
Description This method converts all values in Source to strings as XMLDateTimeToString method does. Then it returns a united value as XMLUniteStrings method does. Example
Dim A As Application Dim Element As XMLElement, Values() As Date Element.AddText A.XMLDateTimesToString (Values, Zone:=120)
XMLTimesToString Parameters
Source() As Date, Optional Zone As Integer, Optional Fractional As Integer = 0 String
Returns
Application
Page 2-48
Description This method converts all values in Source to strings as XMLDateToString method does. Then it returns a united value as XMLUniteStrings method does. Example
Dim A As Application Dim Element As XMLElement, Values() As Date Element.AddText A.XMLDatesToString (Values)
XMLUTCDateTimesToString Parameters
Source() As Date, Zone As Integer, Optional Fractional As Integer = 0 String
Returns
Description This methods converts all values in Source to strings asXMLUTCDateTimeToStringmethod does. Then it returns a united value as XMLUniteStrings method does. Example
Dim A As Application Dim Element As XMLElement, Values() As Date Element.AddText A.XMLUTCDateTimesToString(Values, -480)
XMLUTCTimesToString Parameters
Source() As Date, Zone As Integer, Optional Fractional As Integer = 0 String
Returns
Description This methods converts all values in Source to strings asXMLUTCTimeToString method does. Then it returns a united value as XMLUniteStrings method does. Example
See XMLUTCDateTimesToString
Application
Page 2-49
While Not A.XMLValidName(Name) ' Ask operator for other name Wend
Application
Page 2-50
Chapter 3 - PrivateTool
Description A PrivateTool object is created by the PrivateTools method AddPrivateTool. Note: the default private tool (see PrivateTools) does always exist. Example
Dim A As Application Dim PTS As PrivateTools Dim PT As PrivateTool Set A = New Application A.GetPrivateTools PTS PTS.GetFirst PT IF PT.Default Then ' The set of private tools contains always ' the Default private tool. MsgBox "This is the default private tool" End If
Properties
Active Default Tooltip MenuEnabled MenuString Snapping TargetEnabled TargetType TargetPosition Cursor OnPrivateTool OnMouseMove OnMouseDown OnMouseUp OnMouseDoubleClick OnRightMouseDown OnRightMouseUp OnRightMouseDoubleClick OnMiddleMouseDown OnMiddleMouseUp OnMiddleMouseDoubleClick
Properties
Active Returns
Boolean
Description This property returns True if the private tool is active. Only one private tool can be active at any time. Activating and deactivating a private tool can only done by the user by clicking on the VBA private tools and/or Pythagoras tools. Example
Dim PT As PrivTool If PT.Active Then End If
PrivateTool
Page 3-1
Default Returns
Boolean
Description This property returns True for the private tool that is managed by the Application properties PrivateToolMenuEnabled, PrivateToolMenuString etc. Example
Dim A As Application Dim PrivTools As PrivateTools Dim PT As PrivTool If PT.Default Then End If
Tooltip Returns
String
Description This property sets or returns the tooltip text for the private tools toolbar button. Example
Dim A As Application Dim PrivTools As PrivateTools Dim PT As PrivTool PT.Tooltip = "This is a tooltip"
MenuEnabled Parameters
Boolean
Description Sets the status of the Private Tool menu item: True for enabled, False for disabled. The disabled private tools will remain visible but disabled in the toolbar and menu. Only enabled private tools can be made active (selected). Example
Dim A As Application Dim PTS As PrivateTools Dim PT As PrivateTool Set A = New Application A.GetPrivateTools PTS PTS.GetFirst PT PT.MenuEnabled = True
MenuString Parameters
String
Description Sets the name of the Private Tool menu item. The maximum length of a menu name is 32 characters. Example
Dim A As Application Dim PTS As PrivateTools Dim PT As PrivateTool Set A = New Application A.GetPrivateTools PTS
PrivateTool
Page 3-2
Snapping Parameters
ObjectTypes As Long
Description Sets the types of objects that Pythagoras will snap to when the Private Tool has been selected before calling the OnMouseMove Event Macro. The value ObjectTypes specifies the types of objects (points, lines, ...) the cursor will snap to in the Private Tool Mode. So if Snapping returns ptPoint, the cursor will only snap to points. ObjectTypes is defined as the sum of one or more constants of the type ObjectTypes defined in the section "Constants" of this document. If Snapping returns ptAll, the cursor will snap to all object types. Even if there is no OnMouseMove Event Macro, the cursor will snap only to the objects set by this property. When ptLine and ptPoint is in ObjectTypes, cursor will also snap to intersection points of lines. Example
Dim A As Application Dim PTS As PrivateTools Dim PT As PrivateTool Set A = New Application A.GetPrivateTools PTS PTS.GetFirst PT PT.Snapping = ptPoint+ptLine
TargetEnabled Parameters
Boolean
Description Sets the status of the Target. If the target is enabled, a marker is displayed on the screen on the document position given by the method TargetPosition. The default target type = ptGPSPositionFound. Only one private tool can have a target enabled. Example
Dim A As Application Dim PTS As PrivateTools Dim PT As PrivateTool Set A = New Application A.GetPrivateTools PTS PTS.GetFirst PT PT.TargetEnabled = TRUE
TargetType Parameters
Integer
Description Sets the type of the Target (marker) when the private tool is enabled. The value can be either ptGPSPositionFound or ptGPSSearchingPosition. Example
Dim A As Application Dim PTS As PrivateTools Dim PT As PrivateTool Set A = New Application A.GetPrivateTools PTS PTS.GetFirst PT
PrivateTool
Page 3-3
TargetPosition Parameters
XYZ
Description Sets the position of the target. The position is in local coordinates. The target is a marker on the screen, and is used to highlight a position. This could be for example the position received from GPS equipment. The display of the target has only effect if the private tool is selected. Example
Dim Dim Dim Dim A As Application PTS As PrivateTools PT As PrivateTool Pos As XYZ
Cursor Parameters
Integer
Description Sets the type of the cursor when the private tool is active. The cursor type remains active until either the macro library is terminated or when the private tool Cursor is changed. The value is any of the constants specified in section Chapter 123 - Constants, item Cursors. Example
Dim PT As PrivateTool If PT.Active Then PT.Cursor = ptCursorP1 End If
OnPrivateTool, OnMouseMove, OnMouseDown, OnMouseUp, OnMouseDoubleClick, OnRightMouseDown, OnRightMouseUp, OnRightMouseDoubleClick, OnMiddleMouseDown, OnMiddleMouseUp, OnMiddleMouseDoubleClick Parameters
EventSubName As String
Description Sets the corresponding event macro (a VBA Sub) for a non-defaultprivate tool. The event macro with the specified name must be defined in the macro library. This macro will be called each time when the event occurs for the private tool being in selected state. In order to disable the event processing the string "" can be specified. See also Chapter 1, section Events for more information about the type of events and how events are handled by Pythagoras and passed to the event macro. Example
Dim A As Application Dim PrivTools As PrivateTools Dim PT As PrivTool Set A = New Application A.GetPrivateTools PrivTools PrivTools.GetFirst PT PrivTools.GetNext PT
PrivateTool
Page 3-4
PT.OnPrivateTool = "MyOnPrivateTool"
PrivateTool
Page 3-5
Chapter 4 - PrivateTools
Description The PrivateTools object allows creating and manipulating several Private Tool objects. It represents a set of private tools in Pythagoras. The PrivateTools object is created by the Application method GetPrivateTools. Pythagoras supports up to 31 private tools. Note : the PrivateTools object contains always the private tool whose properties are accessible through the Application properties PrivateToolMenuEnabled, PrivateToolMenuString etc. Example
Dim A As Application Dim PrivTools As PrivateTools Dim PT As PrivTool Set A = New Application A.GetPrivateTools PrivTools PrivTools.GetFirst PT IF PT.Default Then ' The set of private tools contains always ' (as first) the Default private tool. MsgBox "This is the default private tool" End If
Properties Methods
Methods
GetFirst Parameters
PrTool As PrivateTool
Description Returns the first private tool. The first private tool is always the default private tool (accessible through Application). Example
See introduction.
GetNext Parameters
PrTool As PrivateTool
Description Returns the next private tool. If there is no next private tool, Nothing is returned. Example
Dim A As Application Dim PTS As PrivateTools Dim PT As PrivateTool Set A = New Application A.GetPrivateTools PTS PTS.GetFirst PT
PrivateTools
Page 4-1
PTS.GetNext PT
GetActivePrivateTool Parameters
PrTool As PrivateTool
Description Returns the active (selected) private tool if any. If no private tool is active Nothing is returned. Example
Dim A As Application Dim PTS As PrivateTools Dim PT As PrivateTool Set A = New Application A.GetPrivateTools PTS PTS.GetActivePrivateTool PT
SetPrivateToolActive Parameters
PrTool As PrivateTool
Description Sets the argument private tool to be active (selected). The previous active private tool, if any, will be deactivated (deselected) Example
Dim A As Application Dim PTS As PrivateTools Dim PT As PrivateTool Set A = New Application A.GetPrivateTools PTS PTS.SetActivePrivateTool PT
AddPrivateTool Parameters
PrTool As PrivateTool, Optional Icon As Variant := ptDefaultIcon
Description Adds a new private tool. The new private tool will be added to the menu Tools and an icon will be added in the Macro Tools toolbar. By default, the new private tool will be enabled. The parameter PrTool is the new created PrivateTool object. The optional parameter Icon defines the icon that is displayed in the toolbar. Normally the value will be either: (1) the full path name of a custom icon file (extention .ICO) e.g. "C:\MyIcons\MyCustomIcon.ico" or (2) the name of an icon in the folder <PythagorasDirictory>\Macros\. Alternatively the parameter Icon may be one of the following values: ptIconDefault, ptIconRed, ptIconOrange, ptIconYellow, ptIconGreen, ptIconBlue, ptIconIndigo, ptIconViolet, These icons represent the default icon (see below) and icons with the colors: red, orange, yellow, green, blue, indigo and violet. When the parameter is not given, the icons will have a sequential number (1, 2, A, B, ). Example
Dim A As Application Dim PTS As PrivateTools Dim PT As PrivateTool
PrivateTools
Page 4-2
Set A = New Application A.GetPrivateTools PTS PTS.AddPrivateTool PT, "C:\MyIcons\MyCustomIcon2.ico" PT.MenuString = "My Tool 2" PTS.AddPrivateTool PT, "MyCustomIcon1.ico" PT.MenuString = "My Tool 1" PTS.AddPrivateTool PT, ptIconBlue PT.MenuString = "My Tool 3"
RemovePrivateTool Parameters
PrTool As PrivateTool
Description Removes the private tool. The default (standard) private tool cannot be removed. Example
Dim A As Application Dim PTS As PrivateTools Dim PT As PrivateTool Set A = New Application A.GetPrivateTools PTS PTS.RemovePrivateTool PT
PrivateTools
Page 4-3
Chapter 5 - Document
Description A Document object is created by the Application methods OpenDocument and GetNewDocument. A reference to an existing Pythagoras document can be obtained with the method GetActiveDocument. Example
Dim A As Application Dim Doc1 As Document, Doc2 As Document Set A = New Application A.GetNewDocument Doc1 ' Untitled document becomes the top window A.OpenDocument "C:\Test.pyt", False, Doc2 ' Test.pyt will be opened
Properties
ReadOnly NewGroupId Name SnappedObjectPosition EventCursorPosInDoc EventCursorPosInWindow Info Extent FolderExternalFile ActiveOverlay Scale Database LockedDatabase DifferentDatabaseLock NrOfTables NrOfAttributeTables NrOfDictionaryTables NrOfViews NextPointIdent Save SaveAs CloseDoc NewState EndState ClearUndo UpdateScreen RedrawDocument GetOverlay GetSelection GetFlaggedObjects GetObjectUnderCursor ObjectReferenceToCadObject GetKeyboardEventData Paste ImportShape ImportShapeRegion ImportDXF - ImportDWG ImportDataCollector GetActiveCoordinateSystem TransformXYTo TransformXYFrom TransformPossible Center Zoom ZoomRectangle FitInWindow ShowAll GetLayerGroups
Methods
Document
Page 5-1
GetSymbolLibrary GetWindow GetTerrainModels GetSubDocuments FirstTable NextTable TableByName CreateTable ImportDBF DropTable CopyTableSkeleton CopyTable FirstDBView NextDBView DBViewByName CreateSimpleQuery CreateAggregationQuery DropQuery CopyQuery CopyDatabaseSkeleton CopyDatabase PurgeDatabase DropDatabase LockDatabase UnLockDatabase ActualizeQueries GetThematicMaps GetViews PointIdentUsed
Properties
ReadOnly Returns
Boolean
Description This property returns true if the document is read-only. The user can have only read-only access due to settings in the file system, or because already another user has opened the document for read-write. Example
Dim A As Application Dim Doc As Document Set A = New Application A.GetActiveDocument Doc If Doc.ReadOnly then End If
NewGroupId Returns
Long
Description This property returns a free Group identifier. Maximum 65535 group identifiers (0 .. 65534) can be used in a document. If no group identifier free, -1 is returned. If a document contains subdocument, this property returns a new group identifier in the main document. Existing group identifiers in subdocuments will not be taken into account. As a consequence objects in different subdocuments can have the same Group identifier although they will not belong to the same group. This property is obsolete should be replaced by Overlay method CreateCompound. Example
Dim A As Application Dim Doc As Document Page 5-2
Document
Dim Group As Long Set A = New Application A.GetNewDocument Doc Group = Doc.NewGroupId
Name Returns
String
Description This property returns the filename of the document. E.g. "C:\Test.pyt". If the document contains subdocuments, the property will always return the name of the main document. Example
Dim FileName As String FileName = Doc.Name
SnappedObjectPosition Returns
XYZ
Description This property returns the XYZ coordinates of the adjusted position of the cursor in the active document. Adjusted in this context means that not the real coordinates of the cursor are returned, but the coordinates of the object the cursor has snapped to. These coordinates will always be identical to the coordinates shown in the control panel. This property may only be used when processing a mouse event macro. E.g. OnMouseMove. Example
Dim Dim Dim Dim Dim A As Application D As Document Obj As CadObject L As Line Pos As XYZ
Set A = New Application A.GetActiveDocument D D.GetObjectUnderCursor ptLine, Obj If not (Obj is nothing) Then Obj.GetLine L Pos = D.SnappedObjectPosition End if
EventCursorPosInDoc Returns
XY
Description This property returns the XY coordinates of the position of the cursor in the active document. This property may only be used when processing a mouse event macro. E.g. OnMouseMove. Example
Dim Dim Dim Dim Dim A As Application Doc As Document P As XY Obj As CadObject T As Text
Set A = New Application A.GetActiveDocument Doc Doc.GetObjectUnderCursor ptText, Obj If not (Obj is nothing) Then Obj.GetText T P = Doc.EventCursorPosInDoc T.Position = P
Document
Page 5-3
End If
EventCursorPosInWindow Returns
WindowCoord
Description This property returns the coordinates of the position of the cursor in the window. This property may only be used when processing a mouse event macro. E.g. OnMouseMove. Example
Sub OnMouseUp Dim A As Application Dim D As Document Set A = New Application A.GetActiveDocument D MsgBox "X : " & D.EventCursorPosInWindow.X ", Y : " & D.EventCursorPosInWindow.Y End Sub
& _
Info Returns
DocInfo
Extent Returns
Rectangle
Description This property returns the extent (the enclosing rectangle) of the document in local coordinates. The extent includes the main document and all non-sleeping subdocuments. Example
Dim A As Application Dim D As Document Dim R As Rectangle Set A = New Application A.GetActiveDocument D If Not (D is Nothing) then R = D.Extent end if
Document
Page 5-4
FolderExternalFile Returns
String
Description This property sets or returns the folder used for accessing external files. Example
Dim A As Application Dim D As Document Set A = New Application A.GetActiveDocument D If Not (D is Nothing) then D.FolderExternalFile = "C:\ExternalFiles\" end if
ActiveOverlay Returns
Overlay As Integer
Description ActiveOverlay returns or sets the active overlay. The value is either ptPaper or ptDrawing. Example
Dim A As Application Dim D As Document set A = New Application A.GetActiveDocument D If Not (D is Nothing) then D.ActiveOverlay = ptPaper end if
Scale Returns
Scale As Double
Description Scale returns the default scale of the active document. Example
Dim A As Application Dim D As Document set A = New Application A.GetActiveDocument D If Not (D is Nothing) then MsgBox CSTR(D.Scale) end if
ZoomFactor Parameters
ZoomFactor As Double
Description ZoomFactor : returns the actual zoomfactor. When ZoomFactor = 1.0, the document is displayed at the right scale. Example
Sub PM_ZoomFactor Dim A As Application Dim D As Document Set A = New Application
Document
Page 5-5
ActiveSheet Returns
S As Sheet
Description ActiveSheet sets or returns the active sheet. The object Sheets provides methods GetActive and SetActive that have the same function. Example
Dim A As Application Dim D As Document Dim S As Sheet set A = New Application A.GetActiveDocument D If Not (D is Nothing) then Set S = D.ActiveSheet End If
Database Returns
Database
LockedDatabase, DifferentDatabaseLocks, NrOfTables, NrOfAttributeTables, NrOfDictionaryTables, NrOfViews These properties are duplicates of properties in Database class, ex. Document.NumberOfTables call is the same as Document.Database.NumberOfTables . NextPointIdent Returns
String
Description Returns the next point number according to the current document settings or sets (modifies) the next point number in the current document settings. When the point number is set, the following rules apply: 1) The string is empty: point numbering will be switched off. (Points will not get a point number) 2) The string contains no numeric characters: point numbers will increment alphabetically. E.g. A, B, C, 3) The string contains numeric characters: the last numeric part will be incremented. E.g. A01, A02, A03, Example
Dim D As Document Dim pointNumber As String pointNumber = D.NextPointIdent D.NextPointIdent = S01 Next point numbers will become S01, S02, S03,
Document
Page 5-6
Methods
Save Parameters
None
Description Saves the document if any changes were done. If the requested document was a new Untitled document, the user will be prompted to give the name of the document. Example
Doc As Document Doc.Save
SaveAs Parameters
FileName As String, DocVersion As Integer
Description Saves the current document with the path and filename in FileName. If the parameter FileName is empty, then a dialog box will come up prompting the user to enter the filename. DocVersion : ptV11 : file is saved in Pythagoras 11 format. DocVersion : ptV12 : file is saved in Pythagoras 12 format. DocVersion : ptLastVersion(-1) : file is saved in the most recent format. DocVersion : ptDXF13 : file is saved in AutoCAD 13 DXF format. DocVersion : ptDXF14 : file is saved in AutoCAD 14 DXF format. DocVersion : ptDXF2000 : file is saved in AutoCAD 2000 DXF format. DocVersion : ptDXF2004 : file is saved in AutoCAD 2004 DXF format. DocVersion : ptDXF2007 : file is saved in AutoCAD 2007 DXF format. DocVersion : ptDXF2010 : file is saved in AutoCAD 2010 DXF format. DocVersion : ptDWG13 : file is saved in AutoCAD 13 DWG format. DocVersion : ptDWG14 : file is saved in AutoCAD 14 DWG format. DocVersion : ptDWG2000 : file is saved in AutoCAD 2000 DWG format. DocVersion : ptDWG2004 : file is saved in AutoCAD 2004 DWG format. DocVersion : ptDWG2007 : file is saved in AutoCAD 2007 DWG format. DocVersion : ptDWG2010 : file is saved in AutoCAD 2010 DWG format. DocVersion : ptGRBFile2D: file is saved in GRB DXF 2D format. DocVersion : ptGRBFile2_5D: file is saved in GRB DXF 2.5D format. DocVersion : ptGRBFile3D: file is saved in GRB DXF 3D format. If the document can not be saved in the requested format, the run-time error 1028 is raised. Example
Doc As Document Doc.SaveAs "C:\Test.pyt", ptLastVersion DWG & SHAPE : - units : control panel, - prefix : preferences - CRS : control panel.
CloseDoc Parameters
AddToRecentDocList As Boolean, SaveBeforeClose As Integer, FileName As String, DocVersion As Integer
Document
Page 5-7
Description Closes the document. If AddToRecentDocList = True then the file name is added to the list of recently used documents in the "File" menu. The value of SaveBeforeClose is only significant if changes are made to the document and the document is not yet saved. SaveBeforeClose = ptDontSave : Ignore changes SaveBeforeClose = ptAskUser : Displays dialog box requesting if changes need to be saved. SaveBeforeClose = ptSaveAs : Saves changes before closing document. Name = FileName. If the document can not be saved in the requested format, the run-time error 1028 is raised. Filename : Must contain the file name if SaveBeforeClose = ptSaveAs. DocVersion : See SaveAs method. The document that contains the active macro can not be closed. An error is raised. Example
Dim Doc As Document Dim Name As String Doc.CloseDoc True, ptAskUser, Name, ptLastVersion
NewState Parameters
UndoText As String, RedoText As String
Description NewState starts a new state in Pythagoras so that all operations done on a document between NewState and EndState can be "Undone" by the user. UndoText and RedoText are the texts that will appear in the Undo and Redo Edit menus. When a VB program contains no NewState statement(s), Pythagoras will automatically add a new state for each document that is changed by the VB program. When the program in the following example is executed, the user will have the possibility to undo the creation of the 2nd point and subsequently undo the creation of the first point. Example
Sub NewState Dim A As Application Dim Doc As Document Dim Ovl As Overlay Dim P As Point Dim Position As XYZ Set A= New Application A.GetActiveDocument Doc Doc.GetOverlay ptDrawing, Ovl Position.X=10 Position.Y=10 Position.Z=0 Doc.NewState "Undo Point1", "Redo Point1" Ovl.CreatePoint Position, P ' Create point in Drawing overlay Doc.EndState True Position.X=20 Position.Y=20 Doc.NewState "Undo Point2", "Redo Point2" Ovl.CreatePoint Position, P ' Create a second point Doc.EndState True End Sub
EndState Parameters
KeepChanges As Boolean
Description This method terminates the state initiated by NewState. Normally the parameter KeepChanges will be = True. If the parameter KeepChanges = False then all changes made on the document between NewState and EndState will be removed. This feature is useful to undo changes when an operation cannot
Document
Page 5-8
be successfully terminated. EndState refreshes the screen to reflect all changes made between NewState and EndState. Example
Dim A As Application Dim Doc As Document On Error GoTo ErrorHandle ' processing & creating objects. ' If an error occurs, the code after the label ErrorHandle will restore ' the document to the original state Exit Sub ErrorHandle : Doc.EndState False Doc.UpdateScreen
ClearUndo Parameters
None
Description This method clears all undo states in Pythagoras. The method may be called any time. Other statements that change the document may follow. However the screen will be updated immediately when ClearUndo is called. Example
Dim Doc As Document Doc.NewState "Undo Action 1", "Redo Action 1" ' Update some objects Doc.EndState True Doc.ClearUndo
Doc.NewState "Undo Action 2", "Redo Action 2" ' Update some objects Doc.EndState True User will now be able to undo only the last action.
UpdateScreen Parameters
None
Description UpdateScreen will refresh the screen so that all changes made to a document after NewState will be reflected on the screen. UpdateScreen must not be done after calling EndState. EndState updates the screen. UpdateScreen has to be used to make partial changes visible to the user. If UpdateScreenis used to reflect the progress of the macro, e.g. when creating many objects, then displaying the updates will be much faster if NewState is called after each UpdateScreen. Of course, undo of all operations done by the macro will not be possible. Example
Doc.UpdateScreen
RedrawDocument Parameters
None
Document
Page 5-9
Description RedrawDocument will redraw the complete document. Normally this function should not be required (See UpdateScreen). Example
Doc.RedrawDocument
GetOverlay Parameters
OverlayType As Integer, Ovl As Overlay,
Description GetOverlay returns a reference to either the Paper or Drawing Overlay. OverlayType = ptPaper : Return Paper Overlay. OverlayType = ptDrawing : Return Drawing Overlay. Example
Dim Dim Dim Dim Dim A As Application Doc As Document Position As XYZ NewPoint As Point Drawing As Overlay
Set A= New Application A.GetActiveDocument Doc Doc.GetOverlay ptDrawing, Drawing Drawing.CreatePoint Position, NewPoint NewPoint.Color = ptRed
GetSelection Parameters
SelectedObjects As Selection
Description GetSelection returns the set of selected objects. If no objects are selected, the set is empty. All objects in the set are either in the Drawing or in the Paper overlay. Example
Dim SelectedObjects As Selection Dim Doc As Document Doc.GetSelection SelectedObjects
GetFlaggedObjects Parameters
FlaggedObjs As FlaggedObjects
Description GetFlaggedObjects returns the set of flagged objects. If no objects are flagged, the set is empty. All objects in the set are either in the Drawing or in the Paper overlay. Only VBA can set objects flagged. Objects are set flagged if an operation on multiple flagged objects has to be done at a later state in the program. Example
Dim FlaggedObjs As FlaggedObjects Dim Doc As Document Doc.GetFlaggedObjects FlaggedObjs
GetObjectUnderCursor Parameters
ObjectTypes As Long, Object As CADObject
Document
Page 5-10
Description GetObjectUnderCursor returns the object that is near the cursor on the screen. (Snapped to the object). If no object is snapped, Object = nothing. The input parameter ObjectTypes specifies the types of objects (points, lines, ...) the cursor will snap to. So if ObjectTypes = ptPoint, the cursor will only snap to points, and only a CADObject of type Point can be returned. ObjectTypes is defined as the sum of one or more constants of the type ObjectTypes defined in the section "Constants" of this document. If ObjectTypes = ptAll, the cursor will snap to all object types besides ptCompound. Since new object types may be defined in future versions of Pythagoras, use the constant ptAll. When a new object type is added, ptAll will include the new object types. Example
Public Sub DocumentOnMouseDoubleClick() Dim A As Application Dim D As Document Dim Obj As CadObject Set A = New Application A.GetActiveDocument D D.GetObjectUnderCursor ptPoint + ptLine, Obj If Not (Obj is Nothing) Then Obj.Color = ptGreen A.StopEvent End If
ObjectReferenceToCadObject Parameters
ObjectReference As Long, Subdoc As Subdocument, Object As CADObject
Description ObjectReferenceToCadObject returns the object in the the subdocument SubDoc with the given ObjectReference. If no object is found, an empty object is returned. See also the CADObject property ObjectReference. Example
Dim Dim Dim Dim Dim Dim A As Application D As Document SubDocs As SubDocuments SubDoc As SubDocument ObjRef As Long Obj As CADOBJECT
Set A = New Application A.GetActiveDocument D D.GetSubDocuments SubDocs SubDocs.GetMain SubDoc D.ObjectReferenceToCadObject ObjRef, SubDoc, Obj if Not (Obj is Nothing) then Obj.Color = ptGreen end if
GetKeyboardEventData Parameters
VirtualKeyCode As Long, Character As Byte
Description Returns the Virtual Keycode and the character value of the keyboard key pressed. This method may only be used in a keyboard event macro. If not, an error will be raised. Virtual Keycode : the meaning is different for Macintosh and Windows computer. On Macintosh the virtual keycode is independent of the layout of the keyboard. On Windows, the virtual keycode is already translated depending on the language (EN, GE, NL, ) of the keyboard (eg. QWERTY, AZERTY, QWERZU). Virtual keycode can be used to test on special keys (e.g. F1 .. F12).
Document
Page 5-11
Example
Sub OnKeyDown() Dim Dim Dim Dim A As D As Vkey C As Application Document As Long byte
Set A = New Application A.GetActiveDocument D D.GetKeyboardEventData vkey, C If Chr(c) = "a" then Beep End If End Sub
Paste Parameters
CS As CoordinateSystem, Operations As Integer, Scale As Double
Description This method will paste the content of the clipboard in the drawing. The coordinates on the clipboard are considered to be relative to the selected Coordinate System. The data on the clipboard is scaled with the given scale factor (parameter Scale). When the coordinate system is not initialized, (empty object), then the data is pasted relative to the active coordinate system or projection system. Parameter Operations : is the sum of 1 or more of the following constants : - ptPasteNormal: the method Paste behaves identically as the menu function Paste. - ptMirrorX : mirror around X-axis of CS - ptMirrorY : mirror around Y-axis of CS - ptZToY : the Z-value becomes Y and Y-value becomes Z. (Tipping over data). - ptClearPointNumber : During pasting, the point numbers of the points pasted in the drawing are cleared. - ptAdjustSketch : If points with identical point numbers are found in the drawing, the coordinates of the drawing are retained, and the pasted data is adjusted to fit with the existing points. Example
Sub DoPaste Dim Dim Dim Dim Dim Dim Dim A As Application D As Document CS As CoordinateSystem CSEmpty As CoordinateSystem O As Overlay Pnt As XY Origin As XYZ
set A = New Application A.GetActiveDocument D If Not (D is Nothing) then D.Paste CSEmpty, ptPasteNormal, 1.0 D.GetOverlay ptDrawing, O Origin.x = 1.0 Origin.y = 1.0 Origin.z = 2.0 Pnt.x = 3.0 Pnt.y = 3.0 O.CreateTempCoordinateSystem Origin, Pnt, CS D.Paste CS, ptMirrorX + ptMirrorY, 1.0 end If End sub
Document
Page 5-12
ImportShape Parameters
Optional Name As String = "", Optional AskAttributes As Boolean = True
Description This method will import one ore multiple shape files in the drawing. When no parameters are given, the method behaves in the same way as if the Pythagoras menu item "File", "Import", "Shape" was selected. The parameter name contains none, 1 or multiple files. If this parameter is passed, the dialog box requesting the user to select shape files is not displayed. If the name contains one or more files, the files are imported. If the pathname is omitted, the files should be in the same directory as the previous shape import. If the parameter AskAttributes = False, the dialog box that is normally displayed when one or multiple shape files are imported is not shown and the default values, or the previously entered values in this dialog box are used. Example
Sub DoImportShape Dim A As Application Dim D As Document Dim O As Overlay set A = New Application A.GetActiveDocument D If Not (D is Nothing) then D.ImportShape "C:\MyFiles\File1.shp*File2.shp*File3.shp" ' Imports 3 files. All files are in directory C:\MyFiles ' Dialog box requesting attributes (layer, styles, ) will be displayed. D.ImportShape "File4.shp", False " Imports C"\MyFiles\File4.shp. Same attributes as used above will be used. end If End sub
ImportShapeRegion Parameters
Region = Rectangle, Optional Name As String = "", Optional AskAttributes As Boolean = True
Description The method is similar to the ImportShape method. The difference is that with this method only the Shape objects are imported that are partially or completely inside the specified Region Rectangle. Note that some extra Shape objects lying very close to the borders of Region could be imported too. The borders of Region can be specified as Application.NegativeInfinity or Application.PositiveInfinity (see example below). Example
Dim A As Application, D As Document, R As Rectangle Set A = New Application A.GetActiveDocument D If Not D Is Nothing Then R.x1 = 0.0 R.x2 = A.PositiveInfinity R.y1 = A.NegativeInfinity R.y2 = A.PositiveInfinity D.ImportShapeRegion R, "File4.shp" ' Imports C"\MyFiles\File4.shp. Attributes will be asked. ' Only objects having x > 0 are imported. End If
Document
Page 5-13
Description Imports a DXF/DWG file in the document. Name : the full filename of the DXF/DWG file. If Name = "", request file open dialog will be opened. Scale : the scale used to import the DXF/DWG texts, symbols, lins styles and polygon hatching. The default is the scale of the active drawing. Blocks : defines how to import blocks. Values: ptAsPoints, ptAsSymbols or ptUnpacked. Hatching : defines how to import polygon hatchings. Values: ptNoImport, ptAsSymbols or ptUnpacked) AskAttributes : Show a dialog allowing users to manualy choose parameters. Log : returns a detailed log of the import results. Example
Dim A As Application Dim Doc as Document Dim MyLog as String set A = New Application A.GetActiveDocument Doc If NOT(Doc is nothing) Then Doc.ImportDWG Scale:=1/250.0, AskAttributes:=TRUE, Log:=MyLog If Len(MyLog)>0 Then Msgbox MyLog End If End If
ImportDataCollector Parameters
FileName As String, ShowErrors As Boolean, Status As Integer
Description ImportDataCollector will import the file FileName. This method simulates the command Import, Data Collector. When ShowError = True, then the editor will become active if the import file contains errors. The file FileName should have a structure that corresponds to the format required for the active (configured) data collector. When Geocoding is switched off, the attributes of the points will correspond with the actual default settings. The result of the import is returned in Status. = 0 : ok. = 1 : there are errors in the imported file or the codes but the file could be partially imported. = 2 : no import = 3 : the import is cancelled. If the file with the given name does not exist the error 1402 "File with given name not found" is raised. Example
Dim Dim Dim Dim A As Application Doc As Document Status As Integer ImportFile As String
Set A = New Application A.GetActiveDocument Doc If Not Doc is nothing Then Doc.ImportDataCollector ImportFile, False, Status End If
Document
Page 5-14
GetActiveCoordinateSystem Parameters
CS As CoordinateSystem
Description Gets the active coordinate system. This method returns Nothing, if the active coordinate system = Profile. Example
Dim A As Application Dim Doc As Document Dim CS As CoordinateSystem Set A = New Application A.GetActiveDocument Doc If Not (Doc is Nothing) Then Doc.GetActiveCoordinateSystem CS If CS Is Nothing Then Exit Sub End If If CS.Overlay = ptDrawing Then MsgBox "CS in Local = " & CS.Name Else MsgBox "CS in Page = " & CS.Name End If End If
GetCoordinateReferenceSystem Parameters
CRS As CoordinateReferenceSystem
Description Gets the coordinate reference system of the document. This method returns Nothing if the coordinate reference system is not defined. Example
Dim A As Application Dim Doc As Document Dim CRS As CoordinateReferenceSystem Set A = New Application A.GetActiveDocument Doc If Not (Doc is Nothing) Then Doc.GetCoordinateReferenceSystem CRS If CRS Is Nothing Then MsgBox "CRS = Unknown" Else MsgBox "CRS = " & CRS.Name End If End If
SetCoordinateReferenceSystem Parameters
CRS As CoordinateReferenceSystem
Description This method will assign the coordinate reference system to the local CS of the document. Afterwards, if the document is on top, the control panel will hold the previous coordinate reference system if it is compatible with the new coordinate reference system. If an empty parameter is passed, the previous coordinate reference system of the document is removed. Example
Dim A As Application Dim Doc As Document Dim CRSs As CoordinateReferenceSystems
Document
Page 5-15
Dim CRS As CoordinateReferenceSystem Set A = New Application A.GetActiveDocument Doc A.GetCoordinateReferenceSystems CRSs CRSs.GetCoordinateReferenceSystem"Belgium/Lambert72", CRS If Not (Doc is Nothing) And Not (CRS Is Nothing) Then Doc.SetCoordinateReferenceSystem CRS End If
TransformXYTo Parameters
DestinationCRS As CoordinateReferenceSystem, Pnt As XY XY
Returns
Description TransformXYTo transforms the coordinates Pnt from the CRS of the document to the DestinationCRS taking into account tie points and treatment of residuals that are defined in the document for transformation to the destination CRS. For geographical systems, XY is used to return the latitude, longitude values. These angle values must be passed in degrees decimal. Sequence: x = latitude, y = longitude. For projection systems the (x,y) coordinates are passed/returned in meter. Example
Dim Dim Dim Dim Dim A As Application D As Document DestinationCRS As CoordinateReferenceSystem Pnt As XY LatLong As XY
set A = New Application A.GetActiveDocument D CRSs.GetCoordinateReferenceSystem "WGS84", DestinationCRS Pnt.x = 123456.256 Pnt.y = 258321.128 If D.TransformPossible(DestinationCRS) then LatLong = D.TransformXYTo(DestinationCRS, Pnt) End if
TransformXYFrom Parameters
SourceCRS As CoordinateReferenceSystem, Pnt As XY DocPnt As XY XY
Returns
Description TransformXYFrom transforms the coordinates Pnt from the DestinationCRS to the CRS of the document taking into account tie points and treatment of residuals that are defined in the document for transformation to the destination CRS. For geographical systems, XY is used to return the latitude, longitude values. These angle values must be passed in degrees decimal. Sequence: x = latitude, y = longitude. For projection systems the (x,y) coordinates are passed/returned in meter. Example
Dim A As Application Dim D As Document Dim SourceCRS As CoordinateReferenceSystem
Document
Page 5-16
Dim Pnt As XY Dim DocPnt As XY set A = New Application A.GetActiveDocument D CRSs.GetCoordinateReferenceSystem "WGS84", DestinationCRS Pnt.x = 51.3146424 'Latitude Pnt.y = 4.8776564 'Longitude If D.TransformPossible(DestinationCRS) then DocPnt = D.TransformXYFrom(DestinationCRS, Pnt) End if
Description TransformPossible returns True if the transformation to/from CRS is possible. Example
See TransformXYTo and TransformXYFrom
Center Parameters
P As XY
Description Redraws the document on the screen. Point P of the document will become the center of the window. The display scale will remain unchanged. Example
Sub PM_Center Dim A As Application Dim D As Document Dim p As XY set A = New Application A.GetActiveDocument D If NOT D is nothing Then P.x = 20.0 P.y = 10.0 D.Center P end If End sub
Zoom Parameters
P As XY, Scale As Double
Description Redraws the document on the screen. Point P of the document will become the center of the window. Scale : defines the scale at which the drawing will be displayed. Example
Sub PM_Zoom Dim A As Application Dim D As Document Dim p As XY set A = New Application
Document
Page 5-17
A.GetActiveDocument D If NOT D is nothing Then P.x = 20.0 P.y = 10.0 D.Zoom P, 1/125 end if End sub
ZoomRectangle Parameters
Window As Rectangle
Description ZoomRectangle will change the content of the document window so that the objects (points, lines, ...) within the rectangle defined by the parameter Window will become visible. Window : a rectangle with the coordinates of the bottom left and top right corners of a rectangle in document coordinates. Example
Sub PM_ZoomRectangle Dim A As Application Dim D As Document Dim R As Rectangle set A = New Application A.GetActiveDocument D If NOT D is nothing Then R.x1 = -10.0 R.y1 = 10.0 R.x2 = 10.0 R.y2 = -10.0 D.ZoomRectangle R end if End sub
FitInWindow Parameters
None
Description This method will display the complete drawing on the screen. The parts of the drawing falling outside the page boundary will not be displayed. Behavior is identical as the menu selection : View, Fit In Window. Example
Dim D As Document D.FitInWindow
ShowAll Parameters
None
Description This method will display the complete drawing on the screen. If the drawing fits on the page, the page position will be moved so that the drawing is centered relative to the page. If the drawing does not fit on the page, the page is hidden and all objects will become visible on the screen. Example
Dim D As Document D.ShowAll
Document
Page 5-18
GetLayers Parameters
Ls As Layers
set A = New Application A.GetActiveDocument D If Not (D is Nothing) then D.GetLayers Ls Ls.SetProtected False Ls.SetVisible False Ls.SetWallpaper True Ls.GetFirst L If not L is nothing then L.SetMinimumAndMaximumScale 1/1000, 1/500 set L = nothing end if end if End sub
GetLayerGroups Parameters
Group As LayerGroup
Description GetLayerGroups returns a set containing all layer groups. Remember that in the Pythagoras Layer dialog box, you can create layers and layer groups. A layer group may contain 0, 1 or more layers. Example
Sub Dim Dim Dim Dim PM_DeleteAllLayergroups A As Application D As Document G As LayerGroup LGs As LayerGroups
Set A = New Application A.GetActiveDocument D If Not (D is Nothing) then D.GetLayerGroups LGs MsgBox "Nbr of LayerGroups : " & Str(LGs.NrOfGroups) Do While LGs.NrOfGroups > 0 LGs.GetFirst G LGs.DeleteGroup G Loop MsgBox "Nbr of LayerGroups : " & Str(LGs.NrOfGroups) end if End sub
GetSymbolLibrary Parameters
DocLibrary As Library
Document
Page 5-19
Description GetSymbolLibrary returns the Document Library of the document on which the method is applied. This object can be used to obtain information about all symbols, line styles, hatch patterns and typical sections of the Document Symbol Library. Note : to get information about the System Library, use the Application method GetSymbolLibrary. Example
Dim Dim Dim Dim A As Application D As Document L As Library PS As Symbols
set A = New Application A.GetActiveDocument D If Not (D is Nothing) then D.GetSymbolLibrary L L.GetPointSymbols PS MsgBox "Nr of Document Point symbols : " & str(PS.NrOfSymbols) A.GetSymbolLibrary L L.GetPointSymbols PS MsgBox "Nr of Library Point symbols : " & str(PS.NrOfSymbols) End If
GetWindow Parameters
MyWindow As Window
Description GetWindow returns the Window object of the document on which the method is applied. Example
Dim Dim Dim Dim A D P W As As As As Application Document XY Window
set A = New Application A.GetActiveDocument D If NOT D is nothing Then P.x = 20.0 P.y = 10.0 D.Zoom P, 1/125 A.Wait 2000 D.GetWindow W W.VertScrollThumb = 1 W.HorScrollThumb = 99 end if
GetTerrainModels Parameters
DTMs As TerrainModels
Description GetTerrainModels returns the set of Terrain Models (DTM's) in the document. If there are no DTM's, the set is empty. Example
Dim A As Application Dim D As Document Dim DTMs As TerrainModels set A = New Application A.GetActiveDocument D If NOT D is nothing Then D.GetTerrainModels DTMs end if
Document
Page 5-20
GetSubDocuments Parameters
SubDocs As SubDocuments
Description GetSubDocuments returns the set of subdocuments in the document. There is at least 1 subdocument (the main document) in the set. Example
Dim A As Application Dim D As Document Dim SubDocs As SubDocuments set A = New Application A.GetActiveDocument D If NOT D is nothing Then D.GetSubDocuments SubDocs end if
GetTiePointsSetCollection Parameters
TPSC As TiePointsSetCollection
Description Returns the collection of all Tie Points Sets in the Pythagoras document. Only the sets that are not in the library (see same method on Application) are returned, even if a set is used in the document. Example
Dim Doc As Document Dim TPSC As TiePointsSetCollection Doc.GetTiePointsSetCollection TPSC
FirstTable, NextTable, TableByName, CreateTable, ImportDFB, DropTable, CopyTableSkeleton, CopyTable, FirstDBView, NextDBView, DBViewByName, CreateSimpleQuery, CreateAggregationQuery, DropQuery, CopyQuery, CopyDatabaseSkeleton, CopyDatabase, PurgeDatabase, DropDatabase, LockDatabase, UnlockDatabase, ActualizeQueries Duplicates of methods in Database class, see their descriptions. Ex. Document.DropDatabase call is the same as Document.Database.DropDatabase. GetThematicMaps Parameters
TMs As ThematicMaps
Set A = New Application A.GetActiveDocument D If Not (D is Nothing) then D.GetThematicMaps TMs TMs.GetFirst TM Do While Not (TM Is Nothing) TMs.GetNext TM Loop End If
Document
Page 5-21
GetViews Parameters
Vws As Views
Set A = New Application A.GetActiveDocument D If Not (D is Nothing) then D.GetViews Vws Vws.GetFirst V Do While Not (V Is Nothing) Vws.GetNext V Loop End If
Description Returns True if the PointIdent is already used in the document. Example
Dim A As Application Dim D As Document Dim PntId As String A.GetActiveDocument D PntId = D.NextPointIdent If D.PointIdentUsed(PntId) then A.IncPointIdent PntId End If
Document
Page 5-22
Chapter 6 - Documents
Description A Documents object is a set of all open documents in Pythagoras. The Documents object is created by the Application method GetDocuments. Example
' Macro saves all open documents Dim A As Application Dim Docs As Documents Dim Doc As Document Dim i As Long Set A = New Application A.GetDocuments Docs Docs.GetFirst Doc For i = 1 To Docs.NrOfDocuments Doc.Save Docs.GetNext Doc Next i
Properties Methods
Properties
NrOfDocuments Returns
Long
Methods
GetFirst Parameters
Doc As Document
GetNext Parameters
Doc As Document
Documents
Page 6-1
Chapter 7 - SubDocument
Description A SubDocument object can be obtained from either a CadObject by using the method GetSubdocument or from SubDocumentsby using the methods GetFirst, GetNext, AddSubDocument, GetActive. Example
Dim P As Point Dim SubDoc As SubDocument P.GetSubdocument SubDoc ' Returns the subdocument containing point P.
Properties
Methods
Properties
Name Returns
String
Description This property returns the filename of the subdocument. E.g. "C:\Topo5X3.pyt". Example
Dim FileName As String Dim SubDoc As SubDocument FileName = SubDoc.Name
Active Returns
BOOLEAN
Description This property returns true if the subdocument is the active one. Example
Dim SubDoc As SubDocument If SubDoc.Active Then MsgBox "The document " & SubDoc.Name & " is the active subdocument" End If
Main Returns
BOOLEAN
Description This property returns True if the subdocument is the main document. Example
Dim SubDoc As SubDocument If SubDoc.Main Then MsgBox "The document " & SubDoc.Name & " is the main document"
SubDocument
Page 7-1
End If
Status Returns
Integer
Description This property sets or returns the status of a subdocument. The status of a subdocument is ptSleepingSubDocument, ptWallpaperSubDocument, ptVisibleSubDocument, or ptEditableSubDocument. WARNING: the undo-system of the document is cleared when changing the status. Example
Dim SubDoc As SubDocument If SubDoc.Status = ptSleepingSubDocument Then SubDoc.Status = ptEditableSubDocument End If
NameRelative Returns
Boolean
Description This property sets or returns the way the name of a subdocument is stored in the main document. Relative means that only part of the name (eg. Utilities/WaterNet.pyt) is stored. This is only possible if the subdocument is in the folder or a nested folder of the main document. When moving a document with its subdocuments to another drive or folder, the reference to subdocuments remains valid. Example
Dim SubDoc As SubDocument If SubDoc.NameRelative = False Then SubDoc.NameRelative = True End If
DifferentDatabaseLock Returns
Boolean
Description This property returns true if one of the following conditions is met: 1. Database in the main document is locked, but database in the subdocument is not locked 2. Database in the main document is unlocked, but database in the subdocument is locked. 3. Databases in the main document and in the subdocument are locked with a different name or password. Example
Dim SubDoc As SubDocument If SubDoc.DifferentDatabaseLock Then ' Give warning End If
Methods
GetDocument Parameters
Doc As Document
Description Returns the document that contains this and all other subdocuments.
SubDocument
Page 7-2
Example
SubDocument
Page 7-3
Chapter 8 - SubDocuments
Description A Subdocuments object is a set of all subdocuments in a Pythagoras document. The SubDocuments object is created by the Document method GetSubDocuments. Example
Dim Dim Dim Dim Dim A As Application SubDocs As SubDocuments SubDoc As SubDocument Doc As Document i As Long
set A = New Application A.GetActiveDocument Doc Doc.GetSubDocuments SubDocs SubDocs.GetFirst SubDoc For i = 1 To SubDocs.NrOfSubDocuments - 1 SubDocs.GetNext SubDoc Next i
Properties Methods
Properties
NrOfSubDocuments Returns
Long
Methods
GetFirst Parameters
SubDoc As SubDocument
GetNext Parameters
SubDoc As SubDocument
SubDocuments
Page 8-1
AddSubDocument Parameters
Name As String, State As Integer, SubDoc As SubDocument, Optional HandleDataOfSubdocuments As PtSynchronizeDictionaryData := ptDataRaiseError
Description Adds the file with name equal to Name to a document. The initial state of the document is ptSleepingSubDocument, ptWallpaperSubDocument, ptVisibleSubDocument, or ptEditableSubDocument. A reference to the new subdocument is returned in the parameter SubDoc. If Name is not a complete pathname, the file with name PathNameOverview & Name becomes the subdocument. The subdocument will by default be absolute. If a relative name is required, the SubDocument property NameRelate has to be set. Input parameter HandleDataOfSubdocumentdefines what to do when the overview document and the subdocument to add contain a database dictionary table with the same name and structure, but with different datastamps. Data in such tables can differ. See also description of PtSynchronizeDictionaryData enumeration. When value PtDataDontOpenSubdocument is specified it is possible to test if the subdocument has been added by checking if SubDocisNothing. WARNING: the undo-system of the document is cleared. Example
Dim Dim Dim Dim A As Application SubDocs As SubDocuments SubDoc As SubDocument Doc As Document
set A = New Application A.GetActiveDocument Doc Doc.GetSubDocuments SubDocs SubDocs.AddSubDocument "C:\Topo4x3.pyt", ptSleepingSubDocument, SubDoc
RemoveSubDocument Parameters
SubDoc As SubDocument
Description Removes a Subdocument. WARNING: the undo-system of the document is cleared. Example
Dim Dim Dim Dim A As Application SubDocs As SubDocuments SubDoc As SubDocument Doc As Document
set A = New Application A.GetActiveDocument Doc Doc.GetSubDocuments SubDocs ' .... SubDocs.RemoveSubDocument SubDoc
GetMain Parameters
SubDoc As SubDocument
SubDocuments
Page 8-2
GetActive Parameters
SubDoc As SubDocument
SetActive Parameters
SubDoc As SubDocument
set A = New Application A.GetActiveDocument Doc Doc.GetSubDocuments SubDocs '... SubDocs.SetActive SubDoc
GetDocument Parameters
Doc As Document
Description Returns the document that contains this and all other subdocuments. Example
Dim Doc As Document Dim SubDocs As SubDocuments SubDocs.GetDocument Doc
SubDocuments
Page 8-3
Chapter 9 - View
Description A View object can be obtained from Views by using the methods GetFirst, GetNext, GetView, GetActive. Example
Dim Vs As Views Dim V As View Vs.GetActive V ' Returns the active view.
Properties
Properties
Name Returns
String
Description This property returns or sets the name of the view. Example
Dim V As View MsgBox "The name of this view is " & V.Name
Active Returns
Boolean
Description Returns True if a view is the active view and False otherwise. Example
Dim V As View If V.Active Then MsgBox "The View " & V.Name & " is active" End If
Visible Returns
Visibility As Boolean
Description Returns or sets the visibility of polygon patterns, texts, point numbers, point comments, point elevations, special line styles, and images. Possible values: ptPointNumbers, ptComments, ptPointElevations, ptAreas, ptTexts, ptImages, ptSpecialLineStyles, ptPatterns. Example
Dim Dim Dim Dim A As Application D As Document Vs As Views V As View
View
Page 9-1
View
Page 9-2
Chapter 10 - Views
Description A Views object is a set of all views of a document. The Views object is created by the Document method GetViews. Example
'Find View named as "Main" and make it active Dim A As Application Dim D As Document Dim Vs As Views Dim V As View set A = New Application A.GetActiveDocument D If Not (D is Nothing) then D.GetViews Vs Vs.GetView "Main", V If Not (V Is Nothing) Then V.Active = True End IF End If
Properties Methods
Properties
NrOfViews Returns
Long
Methods
GetFirst Parameters
V As View
Views
Page 10-1
Example
set A = New Application A.GetActiveDocument D If Not (D is Nothing) then D.GetViews Vs Vs.GetFirst V Do While Not(V Is Nothing) V.Visible(ptAreas) = False Vs.GetNext V Loop End If
GetNext Parameters
V As View
GetView Parameters
Name As String V As View
Description Returns the view with a name specified by the argument string or Nothing if there is no such a view. Example
Dim Dim Dim Dim A As Application Vs As Views V As View Doc As Document
GetActive Parameters
V As View
Views
Page 10-2
SetActive Parameters
v As View
Views
Page 10-3
Chapter 11 - ThematicMap
Description A ThematicMap object can be obtained from ThematicMaps by using the methods GetFirst, GetNext. Example
Dim TMs As ThematicMaps Dim TM As ThematicMap TMs.GetFirst TM ' Returns the first thematic map.
Properties
Name Active
Properties
Name Returns
String
Description This property returns or sets the name of the thematic map. Example
Dim TM As ThematicMap MsgBox "The name of this thematic map is " & TM.Name
Active Returns
Boolean
Description This property returns or sets the status (active / inactive) of the thematic map. Example
Dim TM As ThematicMap TM.Active = False
ThematicMap
Page 11-1
Chapter 12 - ThematicMaps
Description A ThematicMaps object is a set of all thematic maps of a document. The ThematicMaps object is created by the Document method GetThematicMaps. Example
'Find Thematic named "Customers" and make it active Dim A As Application Dim D As Document Dim TMs As ThematicMaps Dim TM As ThematicMap set A = New Application A.GetActiveDocument D If Not (D is Nothing) then D.GetThematicMaps TMs TMs.GetFirst TM Do While Not (TM Is Nothing) If TM.Name = "Customers" Then TM.Active = True End If TMs.GetNext TM Loop End If
Properties Methods
Properties
NrOfThematicMaps Returns
Long
Methods
GetFirst Parameters
TM As ThematicMap
ThematicMaps
Page 12-1
A.GetActiveDocument D If Not (D is Nothing) then D.GetThematicMaps TMs TMs.GetFirst TM Do While Not(TM Is Nothing) TMs.GetNext TM Loop End If
GetNext Parameters
TM As ThematicMap
ThematicMaps
Page 12-2
Chapter 13 - Sheet
Description A Sheet object can be obtained from Sheets by using the methods GetFirst, GetNext, GetSheet, GetActive. Example
Dim Shts As Sheets Dim Sht As Sheet Sheets.GetActive Sht ' Returns the active sheet.
Properties
Name Active PaperWidth PaperHeight Margins ScaleFactor Scale Position PageAngle Floating GetAllObjects CreatePoint CreateLine CreateArc CreateCircle CreateText CreateRichText CreateClothoid CreateHorizontalCurve CreateCurve CreatePolygon CreatePath CreateImage InsertImage CreateCompound Duplicate PrintOut SetPrintArea ClearPrintArea
Methods
Properties
Name Returns
String
Description This property returns or sets the name of the sheet. Example
Dim Sht As Sheet MsgBox "The name of this sheet is " & Sht.Name
Active Returns
Boolean
Sheet
Page 13-1
PaperWidth Returns
Width As Double
set A = New Application A.GetActiveDocument D If Not (D is Nothing) Then D.GetSheets Shts Shts.GetActive Sht MsgBox "PaperDiminsions:" & vbCRLF & _ "W = " & Cstr(Sht.PaperWidth) & " H = " & Cstr(Sht.PaperHeight) End If
PaperHeight Returns
Height As Double
Margins Returns
Rect As Rectangle
Description Returns the printable rectangle. The printable rectangle depends on the selected paper size and on the selected printer. P1 is bottom left coordinate and P2 is top right coordinate of printable area. Rect.p1.x = left margin Rect.p1.y = bottom margin Rect.p2.x = PaperWidth - right margin Rect.p2.y = PaperHeigth - top margin Example
Dim Dim Dim Dim Dim A As Application D As Document Shts As Sheets Sht As Sheet Rect As Rectangle
set A = New Application A.GetActiveDocument D If Not (D is Nothing) Then D.GetSheets Shts Shts.GetActive Sht Rect = Sht.Margins
Sheet
Page 13-2
MsgBox Cstr(Rect.p1.x) & " " &Cstr(Rect.p1.y) & " " & _ Cstr(Sht.PaperWidth - Rect.p2.x) & " " & Cstr(Sht.PaperHeight - Rect.p2.y) End If
ScaleFactor Returns
ScaleFactor As Double
Description Returns or sets the scale percentage of the sheet. The scale factor is not the same as scale. When the ScaleFactor = 1.0, the sheet will be printed at the given scale. When ScaleFactor <> 1.0, the Scale will change accordingly but also all elements of the drawing that are expressed in paper dimensions (texts, linewidth, symbols having paper dimensions, ) will be scaled with ScaleFactor. The effect is the same as optical zooming. If only the scale is changed (see next property), paper dimensions (text size, line width, ) remain unchanged. Example
Dim Dim Dim Dim A As Application D As Document Shts As Sheets Sht As Sheet
set A = New Application A.GetActiveDocument D If Not (D is Nothing) Then D.GetSheets Shts Shts.GetActive Sht MsgBox Cstr(Sht.ScaleFactor) End If
Scale Returns
Scale As Double
Description Returns or sets the scale of the sheet. See also ScaleFactor. Example
Dim Dim Dim Dim A As Application D As Document Shts As Sheets Sht As Sheet
set A = New Application A.GetActiveDocument D If Not (D is Nothing) Then D.GetSheets Shts Shts.GetActive Sht Sht.Scale = 0.001 End If
Scale = 1/1000
Position Returns
Pos As XY
Description Returns or sets the position of the sheet (the coordinates of the point (0, 0) in the local coordinate system relative to the bottom left of the sheet). The positions of the other coordinates depend on the angle of the sheet and on Scale and ScaleFactor. Example
Dim Dim Dim Dim Dim A As Application D As Document Shts As Sheets Sht As Sheet Pos As XY Page 13-3
Sheet
set A = New Application A.GetActiveDocument D If Not (D is Nothing) Then D.GetSheets Shts Shts.GetActive Sht Pos = Sht.Position Pos.X = 0.05 Pos.Y = 0.025 Sht.Position = Pos End If
' (0.0, 0.0) is printed at ' position (0.05, 0.025) of the page.
PageAngle Returns
Angle As Double
set A = New Application A.GetActiveDocument D If Not (D is Nothing) Then D.GetSheets Shts Shts.GetActive Sht Angle = Sht.PageAngle End If
Floating Returns
Boolean
Methods
The methods CreatePoint, CreateLine, CreateArc, CreateCircle, CreateText, CreateRichText, CreateClothoid, CreateHorizontalCurve, CreateCurve, CreatePolygon, CreatePath, CreateImage, CreateCompound: create objects in overlay Paper in the sheet. The parameters are identical to the parameters of methods of the same name of the object Overlay.
GetAllObjects Parameters
All As AllObjects, Optional Wallpaper As Boolean = True
Description Returns a set containing all objects in the sheet of a document. This set will always contain all objects in the sheet even if after calling GetAllObjects new objects are added or objects are deleted. Alternatively the Overlay method GetAllObjects can be used with the optional parameter Sheet. Sheet
Page 13-4
The optional parameter Wallpaper defines whether objects of wallpaper layers are included. If this parameter is True then objects of all layers are included. Otherwise only objects of not wallpaper layers are included. Example
Dim Dim Dim Dim Dim A As Application Doc As Document PaperWorld As AllObjects Sht As Sheet Shts As Sheets
Set A= New Application A.GetActiveDocument Doc Doc.GetSheets Shts Shts.GetActive Sht Sht.GetAllObjects PaperWorld PaperWorld.Color = ptRed
CreatePoint Parameters
Position As XYZ, P As Point
Description Creates a point in overlay Paper in the sheet. The object P referring to the created point is returned. The style and attributes of the new created point correspond with the defaults set by the user. Example
See example Overlay.CreatePoint
CreateLine Parameters
P1 As Point, P2 As Point, L As Line
Description Creates a line (in overlay Paper in the sheet) from point P1 to point P2. P1 and P2 are point objects. These points must have been created before calling CreateLine and must be in the same overlay as the new line. The object L referring to the created line is returned. Example
See example Overlay.CreateLine
CreateArc Parameters
P1 As Point, P2 As Point, Center As XY, NewArc As Arc
Description Creates an arc in either Paper (active sheet) or Drawing Overlay. The direction of the arc is counter clockwise from point P1 to point P2. These points must have been created before calling CreateArc and must be in the same overlay as the new arc. The object A referring to the created arc is returned. If the distance of P1 and P2 is not the same, then the error 54 is raised. Example
See example Overlay.CreateArc
CreateCircle Parameters
Center As XYZ, CirclePoint As XYZ, NewCircle As Circle
Description Creates a circle in Paper overlay of the sheet. Center : The centre of the circle. CirclePoint : A point on the circumference of the circle. The object NewCircle referring to the created circle is returned. Sheet
Page 13-5
Example
See example Overlay.CreateCircle
CreateText Parameters
Position As XY, Text As String, T As Text
Description Creates the text with content Text at Position in Paper overlay of the sheet. The object T referring to the created text is returned. The length of Text may be maximum 255 characters. A new line in the text is indicated with a CR (013x) or CRLF. Example
See example Overlay.CreateText
CreateRichText Parameters
Position As XY, Height As Double, Width As Double, Text As String, RT As RichText
Description Creates the RichText object with content Text at Position in Paper overlay of the sheet. The object RT referring to the created RichText is returned. A new line in the text is indicated with vbCrLf. Example
See example Overlay.CreateRichText
CreateClothoid Parameters
P1 As XYZ, P2 As XYZ, RStart As Double, REnd As Double, K As Double, Mirror As Boolean, Cl As Clothoid
Description Creates a clothoid (transition curve) in Paper overlay of the sheet. The object Cl referring to the created clothoid is returned. P1 : Starting point P2 : End point RStart : Radius at starting point REnd : Radius at end point K : K-Factor of the clothoid Mirror : If False the clothoid is in counter-clockwise direction (P1 - P2). If True clockwise. If the radius of the starting or end point is infinite, the value ptMaxDouble must be passed. Note : The parameters must be specified very accurately. If the resulting clothoid can not be calculated, run-time error 1056 will be generated. Example
See example Overlay.CreateClothoid
CreateHorizontalCurve Parameters
Points() As XY, Z As Double, C As Curve
Description Creates a curve through Points with elevation Z in Paper overlay of the sheet. The object C referring to the created curve is returned. The parameter Points must be a dynamic array. A fixed array is not accepted. Example
See example Overlay.CreateHorizontalCurve
Sheet
Page 13-6
CreateCurve Parameters
Points() As XYZ, C As Curve
Description Creates a curve through Points in Paper overlay of the sheet. The object C referring to the created curve is returned. The parameter Points must be a dynamic array. A fixed array is not accepted. Example
See example Overlay.CreateCurve
CreatePolygon Parameters
Objs() As CadObject, Poly As Polygon
Description Creates a polygon in Paper overlay of the sheet. The dynamic array Objs, must contain the elements that make up the polygon and should have the same dimension. (Use Redim). If the polygon contains only one element, this must be a circle. In all other cases, the first element of Objs must be a CadObject of type Point. The following elements can be points, arcs or clothoids. A polygon must be closed, this means the last element must end in the first element. When the last element is an arc or a clothoid, then the end point of that arc or clothoid must be the same as the first point of the polygon. Example : A - B : Line B - C : Arc C - D : Arc D - E : Line E - A : Arc Then Objs must contain (Point A, Arc BC, Arc CD, Point E, Arc EA). The object Poly referring to the created polygon is returned. Example
See example Overlay.CreatePolygon
CreatePath Parameters
Objs() As CadObject, P As Path
Description This method creates a path. The dynamic array Objs, must contain the elements that make up the path and should have the same dimension. (Use Redim). The rules regarding the type and sequence of elements in Objs is the same as for a polygon, except for the rule that the starting point and end point must be the same. The object P referring to the created path is returned. Example See example CreatePolygon. CreateImage Parameters
Name As String, Pos As XY, MyImage As Image
Description Creates a Pythagoras image object referring to an existing Pythagoras image file. (A .IMG-files). If the IMG file does not exist, but a BMP or TIFF file exists, than the Application method ConvertImage has to be used first in order to create an IMG file. Name = name of the Pythagoras image file. MyImage = On return : the image Object. Example
Dim Sht As Sheet Dim Pos As XY
Sheet
Page 13-7
InsertImage Parameters
Name As String, Pos As XY, MyImage As Image
Description Creates a Pythagoras image object enclosed (embedded) in the document. Name = name of a BMP, TIFF, JPG or Pythagoras image file. Pos = the coordinates of the top-left corner, in paper dimensions, of the image. MyImage = On return : the image Object. Example
Dim I As Image Dim Sht As Sheet Dim Pos As XY Pos.x = 0.01 Pos.y = 0.15 Sht.InsertImage "C:\Test\Test.tif", Pos, I
CreateCompound Parameters
Container As Compound
Description Creates a Pythagoras compound object. The compound will contain no elements. Use the CadObject/Point/Line/ property Container to add one object at a time to the compound. If a compound is created in a macro, and no object is included into this compound then the compound can be silently deleted after the macro execution completion. Example
See example Overlay.CreateCompound
Duplicate Returns
Sheet
Description Duplicates the sheet and returns a new sheet. All sheet properties are duplicated except the sheet name. WARNING: the undo-system of the document is cleared. Example
Dim A As Application Dim Sht As Sheet, NewSht As Sheet Dim Doc As Document set A = New Application A.GetActiveDocument Doc Set Sht = D.ActiveSheet Set NewSht = Sht.Duplicate
PrintOut Parameters
Copies As Long, Status As Long
Description Prints one or several Copies of the sheet on the printer specified for the sheet. The sheet may not be floating and all printer settings must match with the attached printer(s). The status of printing is returned in
Sheet
Page 13-8
the parameter Status. The printing is successful if Status = ptOk. Otherwise, ptNotOk is returned in Status. Example
Dim Sht As Sheet Dim Status As Long If Not Sht.Floating Then Sht.PrintOut 1, Status If Status <> 0 Then MsgBox "Cant print the sheet." End If End If
SetPrintArea Parameters
NrOfObjects As Long, Objects() As CadObject
Description Sets the print area of the sheet equal to the polygon formed by the array of CadObjects. It is required that the list of objects contains only points, lines, arcs or clothoids, and that these objects can be connected to a polygon in the order of the array. Example
Dim Dim Dim Dim Dim Dim Dim App As Application Doc As Document Sht As Sheet AllObjs As AllObjects Obj As CadObject Poly As Polygon PolyObjs() As CadObject
Set App = New Application App.GetActiveDocument Doc Set Sht = Doc.ActiveSheet Sht.GetAllObjects AllObjs If AllObjs.Count(ptPolygon) > 0 Then AllObjs.GetFirst ptPolygon, Obj Obj.GetPolygon Poly Redim PolyObjs(1 To Poly.NrOfObjects) Poly.GetPolygonObjects PolyObjs Sht.SetPrintArea Poly.NrOfObjects, PolyObjs Else MsgBox("No polygon") End If
Sheet
Page 13-9
Chapter 14 - Sheets
Description A Sheets object is a set of all sheets of a document. The Sheets object is created by the Document method GetSheets. Example
'Find sheet named as "Overall" and make it floating Dim A As Application Dim D As Document Dim Shts As Sheets Dim Sht As Sheet set A = New Application A.GetActiveDocument D If Not (D is Nothing) then D.GetSheets Shts Shts.GetSheet "Overall", Sht If Not (Sht Is Nothing) Then Sht.Floating = True End IF End If
Properties Methods
Properties
NrOfSheets Returns
Long
Methods
GetFirst Parameters
Sht As Sheet
Sheets
Page 14-1
Example
set A = New Application A.GetActiveDocument D If Not (D is Nothing) then D.GetSheets Shts Shts.GetFirst Sht Do While Not(Sht Is Nothing) Sht.ScaleFactor = 150.0 Shts.GetNext Sht Loop End If
GetNext Parameters
Sht As Sheet
GetSheet Parameters
SheetName As String, Sht As Sheet
Description Returns the sheet with the given name. If the sheet with the given name is not found, then on return Sht = Nothing. Example
Dim Shts As Sheets Dim S As Sheet Shts.GetSheet "Valley", Sht If Not (Sht Is Nothing) Then Sht.ScaleFactor = 100.0 End If
GetActive Parameters
Sht As Sheet
Description Returns the active sheet. The Document property ActiveSheet can be used for the same purpose. Example
Dim Dim Dim Dim A As Application Shts As Sheets Sht As Sheet Doc As Document
Sheets
Page 14-2
SetActive Parameters
Sht As Sheet
Description Sets a sheet active. The Document property ActiveSheet can be used for the same purpose. Example
Dim Dim Dim Dim A As Application Shts As Sheets Sht As Sheet Doc As Document
set A = New Application A.GetActiveDocument Doc Doc.GetSheets Shts '... Shts.SetActive Sht
Sheets
Page 14-3
Chapter 15 - Overlay
Description Objects (points, lines, arcs, ) in a Pythagoras document are created in either the Paper or Drawing Overlay. Example
Dim A As Application Dim Doc As Document Dim Ovl As Overlay Set A = New Application A.GetNewDocument Doc ' Untitled document becomes the top window Doc.GetOverlay ptDrawing, Ovl ' Returns an object referring to the Drawing Overlay of document Doc.
Properties Methods
None CreatePoint CreateLine CreateArc CreateCircle CreateText CreateRichText CreateClothoid CreateHorizontalCurve CreateCurve CreatePolygon CreatePath CreateImage InsertImage CreateCompound GetAllObjects GetCoordinateSystems CreateTempCoordinateSystem CreateUserCoordinateSystem Clip XYToPoint
Properties
None
Methods
If objects are created in Paper overlay using the methods Create_ Obj (Point, line, ), these objects will be created in the active Sheet. When you want to create objects in a specific sheet, you need to use the methods of the Class Sheet. CreatePoint Parameters
Position As XYZ, P As Point
Description Creates a point in either Paper (active sheet) or Drawing Overlay. The object P referring to the created point is returned. The style and attributes of the new created point correspond with the defaults set by the user. Example
Dim Dim Dim Dim A As Application Doc As Document Position As XYZ NewPoint As Point Page 15-1
Overlay
Dim Drawing As Overlay Set A= New Application A.GetActiveDocument Doc Doc.GetOverlay ptDrawing, Drawing Position.X = 10.0 Position.Y = 25.2 Position.Z = 10.0 Drawing.CreatePoint Position, NewPoint NewPoint.Color = ptRed
CreateLine Parameters
P1 As Point, P2 As Point, L As Line
Description Creates a line from point P1 to point P2in either Paper (active sheet) or Drawing Overlay. P1 and P2 are point objects. These points must have been created before calling CreateLine and must be in the same overlay as the new line. The object L referring to the created line is returned. The style and attributes of the new created line correspond with the defaults set by the user. Example
Dim Dim Dim Dim Dim Dim A As Application Doc As Document P1 As Point, P2 As Point NewLine As Line Drawing As Overlay Pos As XYZ
Set A = New Application A.GetActiveDocument Doc Doc.GetOverlay ptDrawing, Drawing Pos.X=10 Pos.Y=10 Pos.Z=0 Doc.NewState "Undo Point1", "Redo Point1" Drawing.CreatePoint Pos, P1 ' Create point in Drawing overlay Doc.EndState True Pos.X=20 Pos.Y=20 Doc.NewState "Undo Point2", "Redo Point2" Drawing.CreatePoint Pos, P2 ' Create a second point Doc.EndState True Drawing.CreateLine P1, P2, NewLine
CreateArc Parameters
P1 As Point, P2 As Point, Center As XY, NewArc As Arc
Description Creates an arc in either Paper (active sheet) or Drawing Overlay. The direction of the arc is counter clockwise from point P1 to point P2. These points must have been created before calling CreateArc and must be in the same overlay as the new arc. The object A referring to the created arc is returned. If the distance of P1 and P2 is not the same, then the error 54 is raised. The style and attributes of the new created arc correspond with the defaults set by the user. Example
Dim Dim Dim Dim Dim Dim Dim A As Application Doc As Document P1 As Point, P2 As Point Pos1 As XYZ, Pos2 As XYZ Center As XY NewArc As Arc Drawing As Overlay
Overlay
Page 15-2
Set A= New Application A.GetActiveDocument Doc Doc.GetOverlay ptDrawing, Pos1.x = 10.0 Pos1.y = 10.0 Pos1.z = 0.0 Drawing.CreatePoint Pos1, Pos2 = Pos1 Pos2.x = -10.0 Drawing.CreatePoint Pos2, Center.x = 0.0 Center.y = 0.0 Drawing.CreateArc P1, P2,
Drawing
P1
P2
Center, NewArc
CreateCircle Parameters
Center As XYZ, CirclePoint As XYZ, NewCircle As Circle
Description Creates a circle in either Paper (active sheet) or Drawing Overlay. Center : The centre of the circle. CirclePoint : A point on the circumference of the circle. The object NewCircle referring to the created circle is returned. The style and attributes of the new created circle correspond with the defaults set by the user. Example
Dim Dim Dim Dim Dim Dim A As Application Doc As Document Center As XYZ, Pos2 As XYZ P1 As point NewCircle As Circle Drawing As Overlay
Set A= New Application A.GetActiveDocument Doc Doc.GetOverlay ptDrawing, Drawing Pos2.x = 10.0 Pos2.y = 10.0 Pos2.z = 0.0 Center.x = 5.0 Center.y = 5.0 Drawing.CreateCircle Center, Pos2, NewCircle ' Creates circle in Drawing Overlay
CreateText Parameters
Position As XY, Text As String, T As Text
Description Creates the text with content Text at Position in either Paper (active sheet) or Drawing Overlay. The object T referring to the created text is returned. The length of Text may be maximum 255 characters. A new line in the text is indicated with a CR (013x) or CRLF. The style and attributes of the new created text correspond with the defaults set by the user. Example
Dim Dim Dim Dim Dim Dim A As Application Doc As Document Position As XY S As String T As Text Drawing As Overlay
Overlay
Page 15-3
Doc.GetOverlay ptDrawing, Drawing Position.x = 10.0 Position.y = 10.0 S = "Line 1" & VbCrLf & "Line 2" Drawing.CreateText Position, S, T
CreateRichText Parameters
Position As XY, Height As Double, Width As Double, Text As String, RT As RichText
Description Creates the RichText object with content Text at Position in either Paper (active sheet) or Drawing Overlay. The object RT referring to the created rich text is returned. A new line in the text is indicated with vbCrLf. The style and attributes of the new created rich text correspond with the defaults set by the user. Example
Dim Dim Dim Dim Dim Dim A As Application Doc As Document Position As XY S As String RT As RichText Drawing As Overlay
Set A= New Application A.GetActiveDocument Doc Doc.GetOverlay ptDrawing, Drawing Position.x = 10.0 Position.y = 10.0 S = "Line 1" & VbCrLf & "Line 2" Drawing.CreateRichText Position, 18., 50., S, RT
CreateClothoid Parameters
P1 As XYZ, P2 As XYZ, RStart As Double, REnd As Double, K As Double, Mirror As Boolean, Cl As Clothoid
Description Creates a clothoid (transition curve) in either Paper (active sheet) or Drawing Overlay. The object Cl referring to the created clothoid is returned. P1 : Starting point P2 : End point RStart : Radius at starting point REnd : Radius at end point K : K-Factor of the clothoid Mirror : If False the clothoid is in counter-clockwise direction (P1 - P2). If True clockwise. If the radius of the starting or end point is infinite, the value ptMaxDouble must be passed. The style and attributes of the new created clothoid correspond with the defaults set by the user. Note : The parameters must be specified very accurately. If the resulting clothoid can not be calculated, run-time error 1056 will be generated. Example
Dim Dim Dim Dim Dim A As Application Doc As Document P1 As XYZ, P2 As XYZ Cl As Clothoid Drawing As Overlay
Overlay
Page 15-4
Doc.GetOverlay ptDrawing, Drawing P1.x = 0.0 P1.y = 0.0 P1.z = 0.0 P2.x = 63.348 P2.y = 6.777 P2.z = 0.0 Drawing.CreateClothoid P1, P2, ptMaxDouble, 100.0, 80.0, False, Cl
CreateHorizontalCurve Parameters
Points() As XY, Z As Double, C As Curve
Description Creates a curve through Points with elevation Z in either Paper (active sheet) or Drawing Overlay. The object C referring to the created curve is returned. The parameter Points must be a dynamic array. A fixed array is not accepted. The style and attributes of the new created curve correspond with the defaults set by the user. Example
Dim Dim Dim Dim Dim A As Application Doc As Document Points() As XY C As Curve Drawing As Overlay
Set A= New Application A.GetActiveDocument Doc Doc.GetOverlay ptDrawing, Drawing Redim Points(0 To 3) Points(0).x = 0.0 Points(0).y = 0.0 Points(1).x = 10.0 Points(1).y = 0.0 Points(2).x = 10.0 Points(2).y = 10.0 Points(3) = Points(0) Drawing.CreateHorizontalCurve Points, 0.0, C ' Creates curve in Drawing Overlay C.Color = ptRed
CreateCurve Parameters
Points() As XYZ, C As Curve
Description Creates a curve through Points in either Paper (active sheet) or Drawing Overlay. The object C referring to the created curve is returned. The parameter Points must be a dynamic array. A fixed array is not accepted. The style and attributes of the new created curve correspond with the defaults set by the user. Example
Dim Dim Dim Dim Dim A As Application Doc As Document Points() As XYZ C As Curve Drawing As Overlay
Set A = New Application A.GetActiveDocument Doc Doc.GetOverlay ptDrawing, Drawing Redim Points(0 To 3) Points(0).x = 0.0 Points(0).y = 0.0 Points(0).z = 1.0 Points(1).x = 10.0 Points(1).y = 0.0
Overlay
Page 15-5
Points(1).z = 2.0 Points(2).x = 10.0 Points(2).y = 10.0 Points(2).z = 3.0 Points(3) = Points(0) Drawing.CreateCurve Points, C C.Color = ptBlue
CreatePolygon Parameters
Objs() As CadObject, Poly As Polygon
Description Creates a polygon in either Paper (active sheet) or Drawing Overlay. The dynamic array Objs, must contain the elements that make up the polygon and should have the same dimension. (Use Redim). If the polygon contains only one element, this must be a circle. In all other cases, the first element of Objs must be a CadObject of type Point. The following elements can be points, arcs or clothoids. A polygon must be closed, this means the last element must end in the first element. When the last element is an arc or a clothoid, then the end point of that arc or clothoid must be the same as the first point of the polygon. Example : A - B : Line B - C : Arc C - D : Arc D - E : Line E - A : Arc Then Objs must contain (Point A, Arc BC, Arc CD, Point E, Arc EA). The object Poly referring to the created polygon is returned. The style and attributes of the new created polygon correspond with the defaults set by the user. Example
Sub PM_CreatePolygon Dim Dim Dim Dim Dim Dim Dim Dim Dim A As Application Doc As Document Points() As XYZ ' Must be a Dynamic Array Objs() As Point CadObjs() As CADObject Poly As Polygon Drawing As Overlay i As Integer PolyStyle As Style, PointStyle As Style
Set A= New Application A.GetActiveDocument Doc Doc.GetOverlay ptDrawing, Drawing Redim Points(0 To 4) Points(0).x = 0.0 Points(0).y = 0.0 Points(0).z = 0.0 Points(1).x = 10.0 Points(1).y = 0.0 Points(1).z = 0.0 Points(2).x = 10.0 Points(2).y = 10.0 Points(2).z = 0.0 Points(3).x = 0.0 Points(3).y = 10.0 Points(3).z = 0.0 Points(4) = Points(0) Redim Objs(0 To 4) Redim CadObjs(0 To 4) PointStyle.Symbol = FALSE PointStyle.Group = "" PointStyle.item = "" PointStyle.StyleId = ptHiddenPoint
Overlay
Page 15-6
For i = 0 To 4 Drawing.CreatePoint Points(i), Objs(i) Objs(i).PointStyle = PointStyle Objs(i).GetCadObject CadObjs(i) Next i Drawing.CreatePolygon CadObjs, Poly PolyStyle.Symbol = FALSE PolyStyle.Group = "" PolyStyle.item = "" PolyStyle.StyleId = ptSolidFill Poly.Pattern = PolyStyle Poly.Color = 211 End Sub
CreatePath Parameters
Objs() As CadObject, P As Path
Description This method creates a pathin either Paper (active sheet) or Drawing Overlay. The dynamic array Objs, must contain the elements that make up the path and should have the same dimension. (Use Redim). The rules regarding the type and sequence of elements in Objs is the same as for a polygon, except for the rule that the starting point and end point must be the same. The object P referring to the created path is returned. Example See example CreatePolygon. CreateImage Parameters
Name As String, Pos As XY, ScaleDependent As Boolean, Scale As Double, MyImage As Image
Description Creates a Pythagoras image object referring to an existing Pythagoras image file. (A .IMG-files). If the IMG file does not exist, but a BMP or TIFF file exists, than the Application method ConvertImage has to be used first in order to create an IMG file. Name = name of the Pythagoras image file. Pos = the coordinates of the top-left corner of the image in the drawing. ScaleDependent = must be set = TRUE when the size of the image, in paper dimensions, will vary with the scale of the drawing. (e.g. when importing multiple georeferenced images). If the size of the image must remain fixed when the scale of the drawing is changed, the parameter ScaleDependent must be set = FALSE. Scale = The scale of the raster file in case the parameter ScaleDependent = True. MyImage = On return : the image Object. Example See example ConvertImage InsertImage Parameters
Name As String, Georeference As Boolean, Pos As XY, ScaleDependent As Boolean, Scale As Double, MyImage As Image
Description Creates a Pythagoras image object enclosed (embedded) in the document. Name = name of a BMP, TIFF, JPG or Pythagoras image file. GeoReference = if True, the file should be either a GeoTiff or a World file (TFW, JGW, ...) should be present. If not, an error will be raised and no image is returned. If an image is georeferenced, the parameters Pos, ScaleDependent, and Scale will not be used.
Overlay
Page 15-7
Pos = the coordinates of the top-left corner of the image in the drawing. ScaleDependent = must be set = True when the size of the image, in paper dimensions, will vary with the scale of the drawing. (e.g. when importing multiple georeferenced images). If the size of the image must remain fixed when the scale of the drawing is changed, the parameter ScaleDependent must be set = FALSE. Scale = The scale of the raster file in case the parameter ScaleDependent = True. MyImage = On return : the image Object. Example
Dim Dim Dim Dim Dim A As Application Doc As Document I As Image Drawing As overlay Pos As XY
Set A = New Application A.GetActiveDocument D D.GetOverlay ptDrawing, Drawing Drawing.InsertImage "C:\Test\Test.tif", True, Pos, True, Scale, I
CreateCompound Parameters
Container As Compound
Description Creates a Pythagoras compound object. The compound will contain no elements. Use the CadObject/Point/Line/ property Container to add one object at a time to the compound. If a compound is created in a macro, and no object is included into this compound then the compound can be silently deleted after the macro execution completion. Example
Dim C As Compound Dim O As Overlay Dim P As Point O.CreateCompound C Set P.Container = C ' Point is added to compound C ' See also example at start of chapter Compound
GetAllObjects Parameters
All As AllObjects, Optional Sht As Sheet, Optional Wallpaper As Boolean = True
Description Returns a set containing all objects in the overlay of a document. This set will always contain all objects in the overlay even if after calling GetAllObjects new objects are added or objects are deleted. The optional parameter Sht is by default Nothing. If Sht <> Nothing AllObjects refers to all objects in the given Sheet. If the overlay is ptDrawingthe parameter Sht must be omitted. Alternatively the Sheet method GetAllObjects can be used. The optional parameter Wallpaper defines whether objects of wallpaper layers and wallpaper subdocuments are included. If this parameter is True then objects of all layers of all visible subdocuments are included. Otherwise only objects of not wallpaper layers of both editable and snappable subdocuments are included. Example
Dim Dim Dim Dim Dim Dim A As Application Doc As Document PaperWorld As AllObjects PaperOverlay As Overlay Sht As Sheet Shts As Sheets
Overlay
Page 15-8
Doc.GetSheets Shts Shts.GetActive Sht Doc.GetOverlay ptPaper, PaperOverlay PaperOverlay.GetAllObjects PaperWorld, Sht PaperWorld.Color = ptRed
GetCoordinateSystems Parameters
CSs As CoordinateSystems
Description Gets the set of coordinate systems in the active overlay. Example
Sub PM_GetCoordinateSystems Dim Dim Dim Dim A As Application D As Document O As Overlay CSs As CoordinateSystems
set A = New Application A.GetActiveDocument D If Not (D is Nothing) then D.GetOverlay ptDrawing, O O.GetCoordinateSystems CSs MsgBox "Nr Of CoordinateSystems: " & Str(CSs.NrOfCoordinateSystems) end if End sub
CreateTempCoordinateSystem Parameters
Origin As XYZ, Orientation As XY, CS As CoordinateSystem
Description Creates a Temporary Coordinate System in either the Paper or the Drawing Overlay. The object CS referring to the new created Coordinate System is returned. Origin = the origin of the new temporary Coordinate System. Orientation = the second point that gives the orientation of the new temporary Coordinate System. Example
Sub PM_CreateTempCoordinateSystem Dim Dim Dim Dim Dim Dim A As Application D As Document CS As CoordinateSystem O As Overlay Orientation As XY Origin As XYZ
set A = New Application A.GetActiveDocument D If Not (D is Nothing) then D.GetOverlay ptDrawing, O Origin.x = 10.0 Origin.y = 10.0 Origin.z = 5.0 Orientation.x = 20.0 Orientation.y = 20.0 O.CreateTempCoordinateSystem Origin, Orientation, CS CS.SetActive end if End sub
Overlay
Page 15-9
CreateUserCoordinateSystem Parameters
Origin As Point, Orientation As Point, CS As CoordinateSystem
Description Creates a User Coordinate System in either the Paper or the Drawing Overlay. The object CS referring to the new created Coordinate System is returned. Origin = the origin of the new User Coordinate System Orientation = the second point that gives the orientation of the new User Coordinate System Example
Dim Dim Dim Dim O As Overlay CS As CoordinateSystem Origin As Point Orientation As Point
Clip Parameters
Poly As Polygon, RemoveOutside As Boolean, Types As Long, _ RemoveImagesOnTheOutside As Boolean
Description Will remove all objects of type in Types which are inside or outside the polygon Poly. RemoveOutside : if True, removes the objects outside the polygon. If False, removes the objects inside the polygon. Types : is the sum of the combination of one or more of the following constants : ptPoint, ptLine, ptArc, ptClothoid, ptText, ptRichText, ptImage, ptCurve, ptPath, ptPolygon, ptCircle, ptCoordinateSystem. RemoveImagesOnTheOutside : if True, images completely outside the polygon will be removed if ptImage in Types. Protected objects will not be clipped. Invisible objects will be clipped. Due to technical reasons, the Clip method automatically inserts an extra state. Example
Dim Dim Dim Dim Dim Dim A As Application Doc As Document Sel As Selection DrawingOverlay As Overlay Obj As CadObject Poly As Polygon
Set A = New Application A.GetActiveDocument Doc Doc.GetOverlay ptDrawing, DrawingOverlay Doc.GetSelection Sel If Sel.Count(ptPolygon) = 1 Then Sel.GetFirst ptPolygon, Obj Obj.GetPolygon Poly DrawingOverlay.Clip Poly, True, ptAll, False End If
Overlay
Page 15-10
Description Returns an existing point that has the requested coordinates. If no point exists with these coordinates, Nothing is returned. This method is only supported for drawing overlay (ptDrawing). Example
Dim Dim Dim Dim Dim A As Application Doc As Document Pos As XYZ P As Point Drawing As Overlay
Set A = New Application A.GetActiveDocument Doc Doc.GetOverlay ptDrawing, Drawing Pos.x = 10.0 Pos.y = 10.0 Set P = Drawing.XYToPoint(Pos)
Overlay
Page 15-11
Chapter 16 - CadObject
Description A CadObject object is a generic object type that encompasses the object types Point, Line, Arc, Circle, Clothoid, Curve, Text, RichText, Image, Polygon, Path, Road, Compound and CoordinateSystem. Several properties and methods accept parameters of type CadObject, e.g. the Document method GetObjectUnderCursor. It is obvious that some functions can only return a generic object type. When the type of a CadObject is known, the CadObject can be converted to its specific object type. The methods GetPoint, GetLine, etc. do not create a new object, but they assign the reference to the object of a specific type. Each CadObject of type ptCoordinateSystem can be converted to a CoordinateSystem, but the inverse is not always the case. The coordinate systems ptLocal, ptPage, ptGlobal and ptTemp can not be converted to a CadObject. Example
Dim Dim Dim Dim Dim A As Application Doc As Document Obj As CadObject P As Point Z As Double
Set A = New Application A.GetActiveDocument Doc Doc.GetObjectUnderCursor ptPoint, Obj If not (Obj is nothing) Then If Obj.ObjectType = ptPoint Then Obj.GetPoint P If P.Elevation > 0.0 Then ' End If End If End If
Properties
ObjectType Color TrueColor Comment Link URL_Link DisplayLevel GroupId Container Layer Overlay CanBeDeleted CanChangeOverlay ObjectReference Selected Flagged Data GetQueryData Sheet All of the above properties but ObjectType are also properties of each specific object type.
Methods
CadObject
GetRichText GetPolygon GetImage GetPath GetCoordinateSystem GetCompound GetDocument GetSubDocument GetReferencingObjects SetData DeleteData ConvertToPolyline SetLink The methods GetDocument andGetSubDocument are also methods of each specific object type.
Properties
ObjectType Returns
Long
Description This property returns the specific type of the object. Valid return values : ptPoint, ptLine, ptArc, ptClothoid, ptText, ptRichText, ptImage, ptCurve, ptPath, ptPolygon, ptCircle, ptCoordinateSystem, ptRoad, ptCompound Example
Dim Obj As CadObject Dim P As Point If Obj.ObjectType = ptPoint Then Obj.GetPoint P End If
Comment Returns
String
Description This property sets or returns the comment (object information) of the CadObject. Example
Dim Obj1 As CadObject, Obj2 As CadObject Obj2.Comment = Obj1.Comment
Link Returns
String
Description This property sets or returns the external link of the CadObject. For setting this property it is recommended to use the method SetLink. The name of the link may be a full or partial path name. If a partial name, the name is relative either to the Folder External File or the the directory of the document containing the link. The link is by default a file (URL_Link = False). Pythagoras does not verify if the file or URL exists. Example
Dim Obj As CadObject Obj.Link = "MyPicture.jpg" Obj.URL_Link = False Obj.SetLine "MyPicture.jpg", False ' Better use this rather than Obj.Link = ...
CadObject
Page 16-2
URL_Link Returns
Boolean
Description This property sets or returns the indication that the external link of the CadObject is either an URL or a file. When setting a link for the first time, by default URL_Link = False. When the link did already exist, this property is not changed. Even if URL_Link = False, the link containing a URL may work if the application linked with the extention (e.g. htm) opens an webbrowser and opens the URL. Example See Link Color Returns
Integer
Description This property sets or returns the color of the CadObject. The color is a sequence number in the standard palette of 256 colors. When the true color of an object is not in the palette, then the nearest color is returned. When applying the property to object types which have no color, then an error is raised. Example
Dim Obj1 As CadObject, Obj2 As CadObject Obj2.Color = Obj1.Color
TrueColor Returns
RGB
Description This property sets or returns the color (RGB) of the CadObject. When applying the property to object types which have no color, then an error is raised. This property may not be applied to a rich text. Example
Dim Obj1 As CadObject Dim RGBColor As RGB RGBColor.Red = 120 RGBColor.Green = 250 RGBColor.Blue = 65 Obj1.TrueColor = RGBColor
DisplayLevel Returns
Integer
Description This property sets or returns the display level of the CadObject. Example
Dim Obj1 As CadObject, Obj2 As CadObject Obj2.DisplayLevel = Obj1.DisplayLevel
GroupId Returns
Integer
Description This property sets or returns the Group to which the CadObject belongs. Because the method NewGroupId returns a free GroupId of the main document without taking into account subdocuments, care must be taken
CadObject
Page 16-3
when working with subdocuments. Two objects that lie in a different subdocument could have the same GroupId even when intentionally they don't belong to the same group. All CADObjects must have the same overlay and belong to the same subdocument. If CADObjects are in ptPaper, then they must be in the same sheet. This property is obsolete. Use the property Container in stead. Example
Dim Obj1 As CadObject, Obj2 As CadObject If Obj1.GroupId <> ptNoGroup Then Obj2.GroupId = Obj1.GroupId End If
Container Returns
Compound
Description This property sets or returns the Compound object containing this CadObject. If applied to a Compound object it returns Nothing. When the CadObject is not an element of a compound, the property returns Nothing. When assigning a Compound to a CadObject, the CadObject will become a member of the Compound. Assigning to Nothing will exclude the CadObject from the compound it belonged to. Example
Dim Obj1 As CadObject, Obj2 As CadObject If Obj1.Container Is Obj2.Container Then If Obj1.Container Is Nothing Then ' Obj1 and Obj2 belong to the same compound Obj2.Container = Nothing End If End If
Layer Returns
String
Description This property sets or returns the Layer of the object. IfLayer = "~SYSTEM~" (name of the System Layer), then the object, when it's a point, arc or clothoid, will be put in the System Layer. Trying to put other objects in the System Layer will have no effect. For more information about System Layer see chapter Layers. Example
Dim Obj1 As CadObject, Obj2 As CadObject Obj2.Layer = Obj1.Layer
Overlay Returns
Integer
Description This property returns the Overlay (ptDrawing or ptPaper) of the object. Example
Dim Obj As CadObject Dim O As Overlay If Obj.Overlay = ptPaper Then 'Call Sub(parameters) End If
CadObject
Page 16-4
CanBeDeleted Returns
Boolean
Description This property returns True if the object can be deleted. In certain cases, e.g. layer of object is protected, an object can not be deleted. Example
Dim Obj As CadObject If Obj.CanBeDeleted Then Obj.Flagged = True End If
CanChangeOverlay Returns
Boolean
Description This property returns True if the overlay of the object can be changed. The overlay of an individual object can only be changed if the object does not refer to another object, and if it not referred to by another object. Example
Dim Obj As CadObject If Obj.CanChangeOverlay Then Obj.Flagged = True End If
ObjectReference Returns
Long
Description This property returns the Object Reference of the Object. Each CadObject of a document has a unique Object Reference. The Object Reference remains unchanged over the lifetime of a document. A database could save Object References to find specific CadObject of a document. See also the Document method ObjectReferenceToCadObject. When a document contains subdocuments, the object reference in the respective subdocument is returned. This means that Object References in the set of subdocuments are not unique. As a consequence, calling ObjectReferenceToCadObject using the result of this call could return another CadObject. Example
Dim Obj As CadObject Dim ObjRef As Long ObjRef = Obj.ObjectReference
Selected Returns
Boolean
Description This property sets an object selected or returns the selection status of the object. A compound object can not be selected. The operation will be ignored when the operation is applied to a Compound object. Selection must be done by selecting individual elements of compound. Example
Dim Obj As CadObject Obj.Selected = True
CadObject
Page 16-5
Flagged Returns
Boolean
Description This property sets an object Flagged or returns the status of Flagged bit of the object. A compound object can not be set Flagged. The operation will be ignored when the operation is applied to a Compound object. Individual elements of compound may be set Flagged. For more information about the Flag, see the object type FlaggedObjects. Example
Dim Obj As CadObject Obj.Flagged = True
Data Returns
DBRow
Description This property returns a DBRowobject if the CAD object is linked to a table. Returns Nothing if the CAD object is not linked to a database table. If the CADObject is an element of a Compound, the data linked to the Compound is returned. Elements of a Compound do not have own data. Example
Dim Obj As CadObject Dim Row As DBRow Set Row = Obj.Data
Description If Query is valid and CAD object linked (see class DBQuery corresponding properties) and contains a row linked to the object, this row is returned. Otherwise Nothing is returned. Example
Dim Obj As CadObject Dim Q As Query Dim Row As DBRow Set Row = Obj.GetQueryData (Q)
Sheet Returns
Sheet
Description This property returns a Sheet object if the CAD object is in paper overlay. Returns Nothing if the CAD object is in overlay ptDrawing. Example
Dim Obj As CadObject Dim S As Sheet S = Obj.Sheet
CadObject
Page 16-6
Methods
CadObjects can not be assigned to objects of a specific type. So the statement : Set P = Obj is not valid. Instead, the statements GetPoint, GetLine, etc. need to be used. GetPoint Parameters
P As Point
Description GetPoint sets the reference to the object in a variable of type Point. Note that the reference is copied, not the object. Example
Dim Obj As CadObject Dim P As Point Obj.GetPoint P ' Same as : Set P = Obj
GetLine Parameters
L As Line
Description GetLine sets the reference to the object in a variable of type Line. Note that the reference is copied, not the object. Example
Dim Obj As CadObject Dim L As Line Obj.GetLine L ' Same as : Set L = Obj
GetArc Parameters
A As Arc
Description GetArc sets the reference to the object in a variable of type Arc. Note that the reference is copied, not the object. Example
Dim Obj As CadObject Dim A As Arc Obj.GetArc A ' Same as : Set A = Obj
GetCircle Parameters
C As Circle
Description GetCircle sets the reference to the object in a variable of type Circle. Note that the reference is copied, not the object. Example
Dim Obj As CadObject Dim C As Circle Obj.GetCircle C ' Same as : Set C = Obj
CadObject
Page 16-7
GetClothoid Parameters
C As Clothoid
Description GetClothoid sets the reference to the object in a variable of type Clothoid. Note that the reference is copied, not the object. Example
Dim Obj As CadObject Dim C As Clothoid Obj.GetClothoid C ' Same as : Set c = Obj
GetCurve Parameters
A As Curve
Description GetCurve sets the reference to the object in a variable of type Curve. Note that the reference is copied, not the object. Example
Dim Obj As CadObject Dim C As Curve Obj.GetCurve C ' Same as : Set C = Obj
GetText Parameters
T As Text
Description GetText sets the reference to the object in a variable of type Text. Note that the reference is copied, not the object. Example
Dim Obj As CadObject Dim T As Text Obj.GetText T ' Same as : Set T = Obj
GetRichText Parameters
RT As RichText
Description GetRichText sets the reference to the object in a variable of type RichText. Note that the reference is copied, not the object. Example
Dim Obj As CadObject Dim RT As RichText Obj.GetRichText RT ' Same as : Set RT = Obj
GetPolygon Parameters
P As Polygon
Description GetPolygon sets the reference to the object in a variable of type Polygon. Note that the reference is copied, not the object.
CadObject
Page 16-8
Example
Dim Obj As CadObject Dim P As Polygon Obj.GetPolygon P ' Same as : Set P = Obj
GetImage Parameters
I As Image
Description GetImage sets the reference to the object in a variable of type Image. Note that the reference is copied, not the object. Example
Dim Obj As CadObject Dim I As Image Obj.GetImage I ' Same as : Set I = Obj
GetPath Parameters
P As Path
Description GetPath sets the reference to the object in a variable of type Path. Note that the reference is copied, not the object. Example
Dim Obj As CadObject Dim P As Path Obj.GetPath P ' Same as : Set P = Obj
GetCoordinateSystem Parameters
CS As CoordinateSystem
Description GetCoordinateSystem returns an object of type CoordinateSystem that corresponds with the CadObject. Note that a Coordinate System is not a CadObject. Example
Dim Obj As CadObject Dim CS As CoordinateSystem Obj.GetCoordinateSystem CS
GetCompound Parameters
Container As Compound
Description GetCompound returns an object of type Compound that corresponds with the CadObject. Note that the reference is copied, not the object. Example
Dim Obj As CadObject Dim C As Compound Obj.GetCompound C
CadObject
Page 16-9
GetDocument Parameters
Doc As Document
Description GetDocument returns the document that contains the CadObject. Example
Dim Obj As CadObject Dim Doc As Document Obj.GetDocument Doc
GetSubDocument Parameters
SubDoc As SubDocument
Description GetSubDocument returns the Subdocument that contains the CadObject. Example
Dim Obj As CadObject Dim SubDoc As SubDocument Obj.GetSubDocument SubDoc
GetReferencingObjects Parameters
Count As Integer, RefObjs() As CadObject
Description GetReferencingObjects returns a list of all the objects that are referencing the CadObject. Referencing objects can be lines, arcs, polygons and paths. For a example a line references two points. Example
Dim Obj As CadObject Dim Count As Integer Dim RefObjs() As CadObject Obj.GetReferencingObjects Count, RefObjs If Count > 0 Then If RefObjs(1).ObjType = ptLine Then ' End If Else no objects referencing to this Object End If
SetData Parameters
Table As DBTable, Data() As ColumnValue
Description SetData inserts a new row into the table and links the row with the Cad Object. Table must refer to a database attribute table that is in the same document as the CAD Object. Data: all columns that are contained in Data are used to initialise the corresponding columns in the table. Other columns will get the default values or remain empty. See also DBTable AddColumn. It the CAD object is already linked to the given table, then the method does the same as the DBRow class Update method. When the CAD object is already linked to another table, an error will be raised. If the CAD object is an element of a Compound, SetData is applied to the compound. Elements of a Compound do not have own data. Example
Dim Obj As CadObject
CadObject
Page 16-10
Dim D As Document Dim T As DBTable Dim Data() As ColumnValue Set T = D.TableByName("Countries") Obj.SetData T, Data
DeleteData Parameters
None
Description If an object has data, DeleteDatadeletes the linked row from the table. If the CAD object is an element of a Compound, the row linked to the compound is deleted. Elements of a Compound do not have own data. Example
Dim Obj As CadObject Obj.DeleteData
ConvertToPolyline Parameters
NrOfPoints As Long, Points() As XYZ
Description Converts a CadObject that represents an arc, a clothoid, a circle, a path, or a polygon to a polyline. Coordinates and the number of polyline points are specified by output arguments Points() and NrOfPoints. Example
Dim P As Polygon Dim Pnts() As XYZ Dim N As Long P.ConvertToPolylineN, Pnts
SetLink Parameters
Link As String, URL_Link As Boolean
Description Sets the external link of the CadObject. The name of the link may be a full or partial path name. If a partial name, the name is relative either to the Folder External File or the directory of the document containing the link. Pythagoras does not verify if the file or URL exists. Example
Dim Obj As CadObject Obj.SetLink "MyPicture.jpg", False ' Better use this rather than Obj.Link = ...
CadObject
Page 16-11
Chapter 17 - Point
Description A Point is a CadObject. A new Point object can be created with the Overlay method CreatePoint. A reference to an existing Pythagoras Point can be obtained with e.g. the method GetPoint. Example
Dim Dim Dim Dim Dim A As Application Doc As Document Pnt As XYZ P As Point Drawing As Overlay
Set A = New Application A.GetActiveDocument Doc Doc.GetOverlay ptDrawing, Drawing Drawing.CreatePoint Pnt, P
Properties
Color Comment Link DisplayLevel GroupId Layer Overlay CanBeDeleted CanChangeOverlay ObjectReference Selected Flagged Container Data PointIdent Coordinates Elevation ZoomFactor PointStyle GetDocument GetSubDocument SetData DeleteData GetCadObject GetOrientation SetOrientation GetScaleFactor SetScaleFactor
Methods
Properties
For a description of the properties Color, TrueColor, Comment, Link, DisplayLevel, GroupId, Layer, Overlay, CanBeDeleted, CanChangeOverlay, ObjectReference, Selected, Flagged, Container, Data, GetQueryData see object type CadObject. PointIdent Returns
String
Example
Dim P As Point Dim O As Overlay Dim Pnt As XYZ O.CreatePoint Pnt, P P.PointIdent = "1"
Coordinates Returns
XYZ
Description This property returns the coordinates of the point. For changing the coordinates, the method Move (see FlaggedObjects) must be used. Example
Dim P As Point Dim O As Overlay Dim Pnt As XYZ O.CreatePoint Pnt, P Pnt = P.Coordinates
Elevation Returns
Double
Description This property sets or returns the elevation of the point. Example
Dim P As Point Dim O As Overlay Dim Pnt As XYZ O.CreatePoint Pnt, P P.Elevation = 2.0
ZoomFactor Returns
Double
PointStyle Returns
Style
Description This property sets or returns the style of the point. Example
Dim P As Point, P2 As Point Dim S As Style, S2 As Style S.Symbol = FALSE
Point
Page 17-2
Methods
CadObjects can not be assigned to objects of a specific type. So the statement : Set P = Obj is not valid. In stead, the statements GetPoint, GetLine, etc. need to be used. For a description of the methods GetDocument, GetSubDocument, SetData, DeleteData see object type CadObject. GetCadObject Parameters
Obj As CadObject
Description GetCadObject sets the reference to the Point in a variable of type CadObject. Note that the reference is copied, not the object. Example
Dim Obj As CadObject Dim P As Point P.GetCadObject Obj ' Same as : Set Obj = P
GetOrientation Parameters
Oblique As Boolean, Angle As Double
Description GetOrientation returns the angle of the point if the parameter Oblique returns True. The variable Oblique returns False if the symbol representing the point remains horizontal. In that case the returned angle is also equal to zero. Example
Dim P As Point Dim Oblique As Boolean Dim Angle As Double P.GetOrientation Oblique, Angle
SetOrientation Parameters
Oblique As Boolean, Angle As Double
Description SetOrientation set the angle of the point if the point is oblique. The variable Oblique must be set False if the symbol representing the point must remain horizontal. In that case the value of the parameter angle is ignored. Example
Const pi = 3.1416 Dim P As Point P.SetOrientation True, 90.0/360.0*pi
GetScaleFactor Parameters
ScaleX As Double, ScaleY As Double Page 17-3
Point
Description GetScaleFactor returns both the factors (X and Y) by which the symbol is scaled. The scale factors are expressed in %. One or both scale factors may be negative. Example
Dim P As Point Dim ScaleX As Double, ScaleY As Double P.GetScaleFactor ScaleX, ScaleY
SetScaleFactor Parameters
ScaleX As Double, ScaleY As Double
Description SetScaleFactor sets the new absolute scale factors (X and Y) of the symbol. So the old scale factors have no effect on the result. The scale factors are expressed in %. A scale factor may be negative. This means that the symbol is mirrored around the corresponding axis. Example
Dim P As Point P.SetScaleFactor -100.0, 100.0 ' Set new scale factors to -100%, 100%
Point
Page 17-4
Chapter 18 - Line
Description A Line is a CadObject. A new Line object can be created with the Overlay method CreateLine. A reference to an existing Pythagoras Line can be obtained e.g. with the method GetLine. Since a line defined by VBA is a Pythagoras line, it is defined by 2 Point Objects. Example
Dim Dim Dim Dim Dim Dim A As Application Doc As Document Pnt1 As XYZ, Pnt2 As XYZ P1 As Point, P2 As Point L As Line Drawing As Overlay
Set A = New Application A.GetActiveDocument Doc Doc.GetOverlay ptDrawing, Drawing Drawing.CreatePoint Pnt1, P1 Drawing.CreatePoint Pnt2, P2 Drawing.CreateLine P1, P2, L
Properties
Color Comment Link DisplayLevel GroupId Layer Overlay CanBeDeleted CanChangeOverlay ObjectReference Selected Flagged Container Data LineStyle Scale Width Arrows LineLength Bearing DeltaZ SlopeLength GetDocument GetSubDocument SetData DeleteData GetCadObject GetBeginPoint GetEndPoint CDZtoXYZ XYZtoCDZ
Methods
Properties
For a description of the properties Color, TrueColor, Comment, Link, DisplayLevel, GroupId, Layer, Overlay, CanBeDeleted, CanChangeOverlay, ObjectReference, Selected, Flagged, Container, Data, GetQueryData see object type CadObject.
Line
Page 18-1
LineStyle Returns
Style
Description This property sets or returns the style of the line. Example
Dim L1 As Line, L2 As Line Dim S As Style, S2 As Style S.Symbol = True S.Group = "Example" S.item = "Wall" L1.LineStyle = S S2 = L1.LineStyle L2.LineStyle = S2
Scale Returns
Double
Description This property sets or returns the scale of the line style. When setting, and the new scale is negative, then the scale of the line will become, or remain negative. Scaling if only applicable to scalable line styles. Example
Dim L1 As Line, L2 As Line L1.Scale = 75.0 L2.Scale = L1.Scale
Width Returns
Double
Description This property sets or returns the width of the line. The line width must be between 0.1 (0.01 mm) and 25.5 (2.55 mm). Example
Dim L1 As Line, L2 As Line L1.Width = 5.0 L2.Width = L1.Width
Arrows Returns
Integer
Description This property sets arrows at the end of the line, or returns a value indicating which ends of the line has arrows. The arrows parameter has the following valid values : ptNoArrows, ptArrowP1, ptArrowP2, ptArrowP1P2. Example
Dim L1 As Line, L2 As Line L1.Arrows = ptArrowP1P2 L2.Arrows = L1.Arrows
LineLength Returns
Double
Line
Page 18-2
Description This property returns the horizontal length of the line. Example
Dim L As Line If L.LineLength > 100.0 Then End If
Bearing Returns
Double
Description This property returns the bearing of the line. The bearing is the angle of the line relative to the north axis and clockwise. Example
Dim L As Line Dim Bearing As Double Bearing = L.Bearing
DeltaZ Returns
Double
Description This property returns the difference in height between the starting point and the end point of the line. Example
Dim L As Line Dim dZ As Double dZ = L.DeltaZ
SlopeLength Returns
Double
Description This property returns the absolute length (3D) of the line. Example
Dim L As Line Dim Slope As Double Slope = L.SlopeLength
Methods
CadObjects can not be assigned to objects of a specific type. So the statement : Set L = Obj is not valid. In stead, the statements GetPoint, GetLine, etc. need to be used. For a description of the methods GetDocument, GetSubDocument, SetData, DeleteData see object type CadObject. GetCadObject Parameters
Obj As CadObject
Line
Page 18-3
Description GetCadObject sets the reference to the Line in a variable of type CadObject. Note that the reference is copied, not the object. Example
Dim Obj As CadObject Dim L As Line L.GetCadObject Obj ' Same as : Set Obj = L
GetBeginPoint Parameters
BeginPoint As Point
GetEndPoint Parameters
EndPoint As Point
CDZtoXYZ Parameters
Chainage As Double, Distance As Double, DeltaZ As Double, _ Pnt As XY, Z As Double
Description CDZtoXYZ converts the values Chainage, Distance and DeltaZ, to coordinates. On entry DeltaZ is the elevation relative to the line. Example
See example for Path
XYZtoCDZ Parameters
Pnt As XYZ, Chainage As Double, Distance As Double, DeltaZ As Double
Description XYZtoCDZ converts the coordinates of a point to the values Chainage, Distance and DeltaZ. On return DeltaZ will be the elevation relative to the projected point the line. Example
See CDZtoXYZ.
Line
Page 18-4
Chapter 19 - Arc
Description An Arc is a CadObject. A new Arc can be created with the Overlay method CreateArc. A reference to an existing Pythagoras Arc can be obtained e.g. with the method GetArc. Example See method CreateArc of the object type Overlay. Properties
Color Comment Link DisplayLevel GroupId Layer Overlay CanBeDeleted CanChangeOverlay ObjectReference Selected Flagged Container Data LineStyle Scale Width Arrows ArcLength Radius DeltaZ SlopeLength ArcAperture Center GetDocument GetSubDocument SetData DeleteData GetCadObject GetBeginPoint GetEndPoint CDZtoXYZ XYZtoCDZ
Methods
Properties
For a description of the properties Color, TrueColor, Comment, Link, DisplayLevel, GroupId, Layer, Overlay, CanBeDeleted, CanChangeOverlay, ObjectReference, Selected, Flagged, Data, GetQueryData see object type CadObject. For a description of the properties Style, Scale, Width, Arrows, and of the methods GetBeginPoint, GetEndPoint, Container, see object type Line. ArcLength Returns
Double
Description This property returns the horizontal length of the arc. Example
Dim MyArc As Arc
Arc
Page 19-1
Radius Returns
Double
DeltaZ Returns
Double
Description This property returns the difference in height between the starting point and the end point of the arc. Example
Dim MyArc As Line Dim dZ As Double dZ = MyArc.DeltaZ
SlopeLength Returns
Double
Description This property returns the absolute length (3D) of the arc. Example
Dim MyArc As Arc Dim Slope As Double Slope = MyArc.SlopeLength
ArcAperture Returns
Double
Description This property returns the angle at the center of the arc in radians. Example
Dim MyArc As Arc Dim Angle As Double Angle = MyArc.ArcAperture
Center Returns
XY
Description This property returns the coordinate of the center of the arc. Example
Dim MyArc As Arc Dim Center As XY
Arc
Page 19-2
Center = MyArc.Center
Methods
CadObjects can not be assigned to objects of a specific type. So the statement : Set L = Obj is not valid. In stead, the statements GetPoint, GetLine, etc. need to be used. For a description of the methods GetDocument, GetSubDocument, SetData, DeleteData see object type CadObject. GetCadObject Parameters
Obj As CadObject
Description GetCadObject sets the reference to the Line in a variable of type CadObject. Note that the reference is copied, not the object. Example
Dim Obj As CadObject Dim MyArc As Arc MyArc.GetCadObject Obj ' Same as : Set Obj = MyArc
GetBeginPoint Parameters
BeginPoint As Point
GetEndPoint Parameters
EndPoint As Point
CDZtoXYZ Parameters
Chainage As Double, Distance As Double, DeltaZ As Double, _ Pnt As XY, Z As Double
Description CDZtoXYZ converts the values Chainage, Distance and DeltaZ, to coordinates. On entry DeltaZ is the elevation relative to the arc. Example
See example for Path
Arc
Page 19-3
XYZtoCDZ Parameters
Pnt As XYZ, Chainage As Double, Distance As Double, DeltaZ As Double
Description XYZtoCDZ converts the coordinates of a point to the values Chainage, Distance and DeltaZ. On return DeltaZ will be the elevation of the projected point the arc. Example
See CDZtoXYZ.
Arc
Page 19-4
Chapter 20 - Circle
Description A Circle is a CadObject. A new Circle can be created with the Overlay method CreateCircle. A reference to an existing Pythagoras Circle can be obtained e.g. with the method GetCircle. Example See method CreateCircle of the object type Overlay Properties
Color Comment Link DisplayLevel GroupId Layer Overlay CanBeDeleted CanChangeOverlay ObjectReference Selected Flagged Container Data LineStyle Scale Width Radius Center RadiusPnt GetDocument GetSubDocument SetData DeleteData GetCadObject
Methods
Properties
For a description of the properties Color, TrueColor, Comment, Link, DisplayLevel, GroupId, Layer, Overlay, CanBeDeleted, CanChangeOverlay, ObjectReference, Selected, Flagged, Container, Data, GetQueryData see object type CadObject. For a description of the properties LineStyle, Scale, Width see object type Line. Radius Returns
Double
Center Returns
XYZ
Circle
Page 20-1
Description This property returns the coordinate (3D) of the center of the circle . Example
Dim MyCircle As Circle Dim Center As XYZ Center = MyCircle.Center
RadiusPnt Returns
XYZ
Description This property returns the coordinate (3D) of the radius point of the circle. The radius point is a point on the circle with the largest Z. Example
Dim MyCircle As Circle Dim RadiusPnt As XYZ RadiusPnt = MyCircle.RadiusPnt
Methods
CadObjects can not be assigned to objects of a specific type. So the statement : Set L = Obj is not valid. In stead, the statements GetPoint, GetLine, etc. need to be used. For a description of the methods GetDocument, GetSubDocument, SetData, DeleteData see object type CadObject. GetCadObject Parameters
Obj As CadObject
Description GetCadObject sets the reference to the Line in a variable of type CadObject. Note that the reference is copied, not the object. Example
Dim Obj As CadObject Dim MyCircle As Circle MyCircle.GetCadObject Obj ' Same as : Set Obj = MyCircle
Circle
Page 20-2
Chapter 21 - Curve
Description A Curve is a CadObject. A new Curve can be created with the Overlay method CreateCurve. A reference to an existing Pythagoras Curve can be obtained e.g. with the method GetCurve. Example See method CreateCurve of the object type Overlay. Properties
Color Comment Link DisplayLevel GroupId Layer Overlay CanBeDeleted CanChangeOverlay ObjectReference Selected Flagged Container Data LineStyle Scale Width NrOfPoints Curvature MaxRounding ThreeD Elevation StartTangent EndTangent GetDocument GetSubDocument SetData DeleteData GetCadObject GetCurvePoints
Methods
Properties
For a description of the properties Color, TrueColor, Comment, Link, DisplayLevel, GroupId, Layer, Overlay, CanBeDeleted, CanChangeOverlay, ObjectReference, Selected, Flagged, Container, Data, GetQueryData see object type CadObject. For a description of the properties Style, Scale, Width see object type Line. NrOfPoints Returns
Integer
Description This property returns the number of control points of the curve. Example
Dim C As Curve Dim Count As Integer Count = C.NrOfPoints
Curve
Page 21-1
Curvature Returns
Integer
Description This property sets or returns the curvature. The curvature must have a value between 0 and 10. Example
Dim C1 As Curve, C2 As Curve C1.Curvature = 5 C2.Curvature = C1.Curvature
MaxRounding Returns
Boolean
Description This property sets or returns a Boolean which corresponds with status of the checkbox 100% smoothed. Example
Dim C1 As Curve, C2 As Curve C1.MaxRounding = False C2.MaxRounding = C1.MaxRounding
ThreeD Returns
Boolean
Description This property returns a Boolean which indicates if the curve is 3D. A curve is 3D if not all control points of the curve have the same elevation. Example
Dim C As Curve Dim Z As Double If C.ThreeD = False Then Z = C.Elevation End If
Elevation Returns
Double
Description This property sets or returns the elevation of a horizontal curve. A curve is horizontal if all control points of the curve have the same elevation. (Is not 3D). If the curve is not horizontal the value ptMaxDouble is returned. Example
Dim C As Curve Dim Z As Double If C.ThreeD = False Then Z = C.Elevation End If
StartTangent Returns
XY
Description This property sets or returns a point which gives the tangent direction at the starting point of the curve. If no tangent point, both coordinates should be equal to ptMaxDouble. Curve
Page 21-2
Example
EndTangent Returns
XY
Description This property sets or returns a point which gives the tangent direction at the end point of the curve. If no tangent point, both coordinates should be equal to ptMaxDouble. Example
Dim C As Curve Dim P As XY P.x = 50.0 P.y = 45.0 C.EndTangent = P
Methods
CadObjects can not be assigned to objects of a specific type. So the statement : Set C = Obj is not valid. In stead, the statements GetPoint, GetCurve, etc. need to be used. For a description of the methods GetDocument, GetSubDocument, SetData, DeleteData see object type CadObject. GetCadObject Parameters
Obj As CadObject
Description GetCadObject sets the reference to the Curve in a variable of type CadObject. Note that the reference is copied, not the object. Example
Dim Obj As CadObject Dim MyCurve As Curve MyCurve.GetCadObject Obj ' Same as : Set Obj = MyCurve
GetCurvePoints Parameters
Points() As XYZ
Description GetCurvePoints returns the control points of the curve. The dimension of the array should be large enough to store the points before calling this method. Example
Dim Points() As XYZ Dim MyCurve As Curve Dim NrOfPoints As Integer NrOfPoints = MyCurve.NrOfPoints Redim Points(1 To NrOfPoints) MyCurve.GetCurvePoints Points
Curve
Page 21-3
Chapter 22 - Clothoid
Description A Clothoid is a CadObject. A new Clothoid can be created with the Overlay method CreateClothoid. A reference to an existing Pythagoras Clothoid can be obtained e.g. with the method GetClothoid. Example See method CreateClothoid of the object type Overlay. Properties
Color Comment Link DisplayLevel GroupId Layer Overlay CanBeDeleted CanChangeOverlay ObjectReference Selected Flagged Container Data LineStyle Scale Width Arrows Length DeltaZ SlopeLength ClothoidConstant (or K) StartRadius EndRadius Mirrored StartCenter EndCenter GetDocument GetSubDocument SetData DeleteData GetCadObject GetBeginPoint GetEndPoint CDZtoXYZ XYZtoCDZ
Methods
Properties
For a description of the properties Color, TrueColor, Comment, Link, DisplayLevel, GroupId, Layer, Overlay, CanBeDeleted, CanChangeOverlay, ObjectReference, Selected, Flagged, Container, Data, GetQueryData see object type CadObject. For a description of the properties Style, Scale, Width, Arrows, and of the methods GetBeginPoint, GetEndPoint, see object type Line. Length Returns
Double
Clothoid
Page 22-1
Description This property returns the horizontal length of the clothoid. Example
Dim C As Clothoid MsgBox "Length spiral = " & C.Length
DeltaZ Returns
Double
Description This property returns the difference in height between the starting point and the end point of the clothoid. Example
Dim C As Clothoid Dim dZ As Double dZ = C.DeltaZ
SlopeLength Returns
Double
Description This property returns the absolute length (3D) of the clothoid. Example
Dim C As Clothoid Dim Slope As Double Slope = C.SlopeLength
Description This property returns the rate of change of curvature also called the K-factor of the spiral curve (clothoid). Example
Dim C As Clothoid Dim K As Double K = C.K
StartRadius Returns
Double
Description This property returns the radius at the starting point of the clothoid. If the radius is infinite, ptMaxDouble is returned. Example
Dim C As Clothoid Dim Radius1 As Double, Radius2 As Double Radius1 = C.StartRadius Radius2 = C.EndRadius
EndRadius Returns
Double
Clothoid
Page 22-2
Description This property returns the radius at the end point of the clothoid. If the radius is infinite, ptMaxDouble is returned. Example
Dim C As Clothoid Dim Radius1 As Double, Radius2 As Double Radius1 = C.StartRadius Radius2 = C.EndRadius
Mirrored Returns
Boolean
Description This property returns the direction of the clothoid. If False the clothoid is in counter-clockwise direction (P1 - P2). If True clockwise. Example
Dim C As Clothoid Dim Radius1 As Double, Radius2 As Double Radius1 = C.StartRadius Radius2 = C.EndRadius
StartCenter Returns
XY
Description This property returns the coordinate of the center of the clothoid at the starting point. Example
Dim C As Clothoid Dim Center1 As XY, Center2 As XY Center1 = C.StartCenter Center2 = C.EndCenter
EndCenter Returns
XY
Description This property returns the coordinate of the center of the clothoid at the end point. Example
Dim C As Clothoid Dim Center1 As XY, Center2 As XY Center1 = C.StartCenter Center2 = C.EndCenter
Methods
CadObjects can not be assigned to objects of a specific type. So the statement : Set C = Obj is not valid. In stead, the statements GetPoint, GetClothoid, etc. need to be used. For a description of the methods GetDocument, GetSubDocument, SetData, DeleteData see object type CadObject.
Clothoid
Page 22-3
GetCadObject Parameters
Obj As CadObject
Description GetCadObject sets the reference to the Clothoid in a variable of type CadObject. Note that the reference is copied, not the object. Example
Dim Obj As CadObject Dim C As Clothoid C.GetCadObject Obj ' Same as : Set Obj = C
GetBeginPoint Parameters
BeginPoint As Point
GetEndPoint Parameters
EndPoint As Point
CDZtoXYZ Parameters
Chainage As Double, Distance As Double, DeltaZ As Double, _ Pnt As XY, Z As Double
Description CDZtoXYZ converts the values Chainage, Distance and DeltaZ, to coordinates. On entry DeltaZ is the elevation relative to the clothoid. Example
See example for Path
XYZtoCDZ Parameters
Pnt As XYZ, Chainage As Double, Distance As Double, DeltaZ As Double
Description XYZtoCDZ converts the coordinates of a point to the values Chainage, Distance and DeltaZ. On return DeltaZ will be the elevation of the projected point the clothoid. Example
See CDZtoXYZ.
Clothoid
Page 22-4
Chapter 23 - Text
Description A Text is a CadObject. A new Text can be created with the Overlay method CreateText. A reference to an existing Pythagoras Text can be obtained e.g. with the method GetText. Example See method CreateText of the object type Overlay. Properties
Color Link DisplayLevel GroupId Layer Overlay CanBeDeleted CanChangeOverlay ObjectReference Selected Flagged Container Data Position Content Orientation Angle Style Weight PointSize HorizontalAlignment VerticalAlignment Underline Border LineSpacing Opaque GetDocument GetSubDocument GetCadObject SetData DeleteData GetAngle GetContent GetFont SetFont
Methods
Properties
For a description of the properties Color, TrueColor, Link, DisplayLevel, GroupId, Layer, Overlay, CanBeDeleted, CanChangeOverlay, ObjectReference, Selected, Flagged, Container, Data, GetQueryData see object type CadObject. Position Returns
XY
Description This property sets or returns the insertion point of the text. Insertion point : a text is aligned relative to its insertion point. Example
Dim T As Text Dim Pos As XY
Text
Page 23-1
Content Returns
String
Description This property sets or returns the content of the text. To obtain the text, the alternative method GetContent returns the text, with the option to replace the placeholders with their respective values. Example
Dim T As Text T.Content = "Text created with VBA" & VbCrLf & "Line 2 of the text"
Orientation Returns
Integer
Description This property sets or returns the orientation of the text. Orientation = ptTextHorizontal: The text will always appear horizontal independent of page orientation or angle. Orientation = ptTextOrientationReadable : The angle of the displayed or printed texts will change if the text would come upside down. If the angle of the texts is in 2nd or 3rd quadrant, the texts are turned over 180 degrees. Orientation = ptTextOrientationAbsolute : The texts are always displayed at the given angle. Warning : when setting the angle with the Angle property, the orientation will always be set to ptTextOrientationAbsolute. Example
Dim T As Text T.Angle = 1.3 T.Orientation = ptTextOrientationReadable
Angle Returns
Double
Description This property sets or returns the angle of the text. When writing, TextAngle will set the orientation to ptTextOrientationAbsolute, even if the angle = 0.0. The angle is expressed in radians. Example
Dim T As Text T.Angle = 1.3 T.Orientation = ptTextOrientationReadable
Style Returns
Integer
Description This property sets or returns the style of the text. Style = ptUpright : Normal Style = ptItalic : Italic
Text
Page 23-2
Example
Weight Returns
Integer
Description This property sets or returns the weight of the text. Weight = ptLight : Light Weight = ptMedium : Normal Weight = ptBold : Bold Weight = ptExtraBold : Extra Bold Not all fonts can be represented Light or Extra Bold. Example
Dim T As Text T.Weight = ptBold
PointSize Returns
Integer
Description This property sets or returns the point size of the text.Value of PointSize must be between 1 and 1000. Example
Dim T As Text T.PointSize = 20
HorizontalAlignment Returns
Integer
Description This property sets or returns the horizontal alignment of the text. Alignment = ptAlignLeft : left aligned. Alignment = ptAlignCenter : centered. Alignment = ptAlignRight : right aligned. Example
Dim T As Text T.HorizontalAlignment = ptAlignRight
VerticalAlignment Returns
Integer
Description This property sets or returns the vertical alignment of the text. Alignment = ptAlignBottom: bottom aligned. Alignment = ptAlignCenter : centered. Alignment = ptAlignTop : top aligned. Example
Dim T As Text T.VerticalAlignment = ptAlignCenter
Text
Page 23-3
Underline Returns
Integer
Description This property sets or returns the underlining of the text. Underline = ptUnderlineNone : no underlining. Underline = ptUnderlineSingle : single underlining. Underline = ptUnderlineDouble : double underlining. Underline = ptUnderlineDashed : underlining dashed line. Example
Dim T As Text T.Underline = ptUnderlineSingle
Border Returns
Integer
Description This property sets or returns the border of the text. Border = ptBorderNone : no border. Border = ptBorderSingle : single border. Border = ptBorderDouble : double border. Example
Dim T As Text T.Border = ptBorderSingle
LineSpacing Returns
Integer
Description This property sets or returns the line spacing of the text. LineSpacing = ptSpacingSmall : small line spacing. LineSpacing = ptSpacingNormal : normal line spacing. LineSpacing = ptSpacingLarge : large line spacing. Example
Dim T As Text T.LineSpacing = ptSpacingSmall
Opaque Returns
Boolean
Description This property sets or returns the transparency of the text. If = True : Opaque Example
Dim T As Text T.Opaque = True
Methods
CadObjects can not be assigned to objects of a specific type. So the statement : Text
Page 23-4
Set T = Obj is not valid. In stead, the statements GetPoint, GetText, etc. need to be used. For a description of the methods GetDocument, GetSubDocument, SetData, DeleteData see object type CadObject. GetCadObject Parameters
Obj As CadObject
Description GetCadObject sets the reference to the Text in a variable of type CadObject. Note that the reference is copied, not the object. Example
Dim Obj As CadObject Dim T As Text T.GetCadObject Obj ' Same as : Set Obj = T
GetAngle Parameters
AngleAsDisplayed As Boolean, Angle As Double
Description GetAngle returns the angle of the text. If the orientation of the text = ptTextHorizontal, then the returned angles is always = 0.0. If the input parameter AngleAsDisplayed = True, then the corrected angle (+180) will be returned if the orientation of the text = ptTextOrientationReadable, and the text without correction would have been displayed upside down. The angle is expressed in radians. Example
Dim T As Text Dim Angle As Double T.GetAngle True, Angle
GetContent Parameters
ReplacePlaceHolders As Boolean, Content As String
Description GetContent returns the content of the text. If the Boolean ReplacePlaceHolders = True, then the variables in the text (^D, ^S, ^F) will be replaced by their actual values. (Date, Scale, File name). Example
Dim T As Text Dim Content As String T.GetContent True, Content
GetFont Parameters
FontName As String, CodePage As Integer
Description GetFont returns the Font name and de codepage of the text. Example
Dim T As Text Dim FontName As String Dim CodePage As Integer T.GetFont FontName, CodePage
Text
Page 23-5
SetFont Parameters
FontName As String, CodePage As Integer
Description SetFont sets the Font name and de codepage of the text. Example
Dim T As Text T.SetFont "Arial", ptWestern
Text
Page 23-6
Chapter 24 - RichText
Description A RichText is a CadObject. Currently there is no VBA interface to create a Rich Text. A reference to an existing Pythagoras Rich Text can be obtained e.g. with the method GetRichText. Example
Dim Obj As CadObject Dim RT As RichText Obj.GetRichText RT RT.Angle = 0
Properties
Link DisplayLevel GroupId Layer Overlay CanBeDeleted CanChangeOverlay ObjectReference Selected Flagged Container Data Position Content Orientation Angle HorizontalAlignment VerticalAlignment Opaque GetDocument GetSubDocument SetData DeleteData GetCadObject GetAngle
Methods
Properties
For a description of the properties Link, DisplayLevel, GroupId, Layer, Overlay, CanBeDeleted, CanChangeOverlay, ObjectReference, Selected, Flagged, Container, Data, GetQueryData see object type CadObject. Position See object type Text. Content Returns
String
Description This property returns the text content of A RichText object as a string. Example
Dim RT As RichText Dim Str As String Str = T.Content
RichText
Page 1
Orientation See object type Text. Angle See object type Text. HorizontalAlignment See object type Text. VerticalAlignment See object type Text. Opaque See object type Text. Border See object type Text.
Methods
CadObjects can not be assigned to objects of a specific type. So the statement : Set RT = Obj is not valid. In stead, the statements GetPoint, GetRichText, etc. need to be used. For a description of the methods GetDocument, GetSubDocument, SetData, DeleteData see object type CadObject. GetCadObject Parameters
Obj As CadObject
Description GetCadObject sets the reference to the RichText in a variable of type CadObject. Note that the reference is copied, not the object. Example
Dim Obj As CadObject Dim RT As RichText RT.GetCadObject Obj ' Same as : Set Obj = RT
RichText
Page 24-1
Chapter 25 - Path
Description A Path is a CadObject. A new Path can be created with the Overlay method CreatePath. A reference to an existing Pythagoras Path can be obtained e.g. with the method GetPath. Example See method CreatePath of the object type Overlay Properties
Color Comment Link DisplayLevel GroupId Layer Overlay CanBeDeleted CanChangeOverlay ObjectReference Selected Flagged Container Data NrOfObjects TotalLength TotalSlopeLength DeltaZ StartingChainage GetDocument GetSubDocument SetData DeleteData GetCadObject GetPathObjects CDZtoXYZ XYZtoCDZ
Methods
Properties
For a description of the properties Comment, Link, DisplayLevel, GroupId, Layer, Overlay, CanBeDeleted, CanChangeOverlay, ObjectReference, Selected, Flagged, Container, Data, GetQueryData see object type CadObject. NrOfObjects Returns
Integer
Description This property returns the number of objects (points, arcs or clothoids) which make up the path. Example
Dim MyPath As Path Dim NrOfObjects As Double NrOfObjects = MyPath.NrOfObjects
TotalLength Returns
Double
Description TotalLength returns the sum of the horizontal lengths of all objects that make up the path. Path
Page 25-1
Example
TotalSlopeLength Returns
Double
Description TotalSlopeLength returns the sum of the slope lengths of all objects that make up the path. Example
Dim MyPath As Path Dim L As Double L = MyPath.TotalSlopeLength
DeltaZ Returns
Double
Description DeltaZ returns the difference in height between the starting point and the end point of the path. Example
Dim MyPath As Path Dim DeltaZ As Double DeltaZ = MyPath.DeltaZ
StartingChainage Returns
Double
Description StartingChainage sets or returns the chainage at the starting point of the path. Example
Dim MyPath As Path Dim StartingChainage As Double StartingChainage = MyPath.StartingChainage
Methods
CadObjects can not be assigned to objects of a specific type. So the statement : Set L = Obj is not valid. In stead, the statements GetPoint, GetLine, etc. need to be used. For a description of the methods GetDocument, GetSubDocument, SetData, DeleteData see object type CadObject. GetCadObject Parameters
Obj As CadObject
Description GetCadObject sets the reference to the Line in a variable of type CadObject. Note that the reference is copied, not the object. Example
Dim Obj As CadObject Dim MyPath As Path
Path
Page 25-2
MyPath.GetCadObject Obj
GetPathObjects Parameters
Objects() As CadObject
Description GetPathObjects returns an array of variables of type CadObject. This array contains all objects of the path (Point, Arc, Clothoid) in the same sequence as they appear in the path. On return, the dimension of the array is always (1 To NrOfObjects). Example
Dim Dim Dim Dim Dim Dim Dim Dim A As Application D As Document Sel As Selection Counter As Long NrPoints As Long, NrArcs As Long, NrClothoids As Long Obj As CadObject Objs() As CadObject Pth As Path
Set A= New Application A.GetActiveDocument D D.GetSelection Sel If Sel.Count(ptPath) = 1 then Sel.GetFirst ptPath, Obj Obj.GetPath Pth Redim Objs(1 To Pth.NrOfObjects) Pth.GetPathObjects Objs For Counter = 1 TO Pth.NrOfObjects Select case Objs(Counter).ObjectType case ptPoint NrPoints = NrPoints + 1 case ptArc NrArcs = NrArcs + 1 case ptClothoid NrClothoids = NrClothoids + 1 case else end select Next counter MsgBox "Points : " & NrPoints & VBCRLF & "Arcs : " & NrArcs & VBCRLF & _ "Clothoids : " & NrClothoids Else MsgBox "Select 1 path" End If
CDZtoXYZ Parameters
Chainage As Double, Distance As Double, DeltaZ As Double, _ Pnt As XY, Z As Double
Description CDZtoXYZ converts the values Chainage, Distance and DeltaZ, to coordinates. On entry DeltaZ must be the elevation relative to the path. The returned elevation will be: Z = DeltaZ + zPath(Chainage). The starting chainage of the path will be taken into account. Example
Dim Dim Dim Dim Dim Dim A As Application Doc As Document Sel As Selection Obj As CadObject Pa As Path Pnt As XY
Path
Page 25-3
Dim Pnt3D As XYZ Dim C As Double, D As Double, Z As Double Set A = New Application A.GetActiveDocument Doc Doc.GetSelection Sel If Sel.Count(ptPath) = 1 Then Sel.GetFirst ptPath, Obj Obj.GetPath Pa Pa.CDZtoXYZ 70.0, 5.0, 1.5, Pnt, Z MsgBox "X = " & Format(Pnt.x, "###.000") & vbNewLine & _ "Y = " & Format(Pnt.Y, "###.000") & vbNewLine & _ "Z = " & Format(Z, "###.000") & vbNewLine Pnt3D.x = Pnt.x Pnt3D.y = Pnt.y Pnt3D.z = Z Pa.XYZtoCDZ Pnt3D, C, D, Z MsgBox "C = " & Format(C, "###.000") & vbNewLine & _ "D = " & Format(D, "###.000") & vbNewLine & _ "Z = " & Format(Z, "###.000") & vbNewLine End If
XYZtoCDZ Parameters
Pnt As XYZ, Chainage As Double, Distance As Double, DeltaZ As Double
Description XYZtoCDZ converts the coordinates of a point to the values Chainage, Distance and DeltaZ. On return DeltaZ will be the elevation relative to the path. The starting chainage of the path will is taken into account. Example
See CDStoXYZ
Path
Page 25-4
Chapter 26 - Road
Description A Road is a CadObject. Currently there is no VBA interface to create a Road. A reference to an existing Pythagoras Road can be obtained e.g. with the method GetRoad. Example
Dim Obj As CadObject Dim R As Road Obj.GetRoad R
Properties
Color Comment Link DisplayLevel GroupId Layer Overlay CanBeDeleted CanChangeOverlay ObjectReference Selected Flagged Data TotalLength StartingChainage
Methods
GetDocument GetSubDocument GetColor SetColor SetData DeleteData GetCadObject GetProfileData GetHorIPData GetSuperElevationData GetRD_CrossSectionPositions GetRD_ReferenceObjects GetCenterLine CDZtoXYZ XYZtoCDZ
Properties
For a description of the properties Comment, Link, DisplayLevel, GroupId, Layer, Overlay, CanBeDeleted, CanChangeOverlay, ObjectReference, Selected, Flagged, Data, GetQueryData see object type CadObject. Color Returns
Integer
Description This property sets or returns the color of the center line of the road. See details in the description of the property Color in the chapter CadObject.
Road
Page 26-1
TotalLength Returns
Double
Description TotalLength returns the sum of the lengths of all objects that make up the road. Example
Dim MyRoad As Road Dim L As Double L = MyRoad.TotalLength
StartingChainage Returns
Double
Description StartingChainage sets or returns the chainage at the starting point of the road. Example
Dim MyRoad As Road Dim StartingChainage As Double StartingChainage = MyRoad.StartingChainage
Methods
CadObjects can not be assigned to objects of a Road type. So the statement : Set R = Obj is not valid. Instead, the statement GetRoad needs to be used. For a description of the methods GetRoad, SetData, DeleteData see object type CadObject. GetCadObject Parameters
Obj As CadObject
Description GetCadObject sets the reference to the Road in a variable of type CadObject. Note that the reference is copied, not the object. Example
Dim Obj As CadObject Dim MyRoad As Road MyRoad.GetCadObject Obj ' Same as : Set Obj = MyRoad
Description This method returns the color of the specified attribute of the Road. The attribute is specified by one of constants ptCenterLineAttr, ptSplitPointAttr, ptReferencePointAttr, andptSlopeInterceptAttr.The color is a sequence number in the standard palette of 256 colors. When the true color of an object is not in the palette, then the nearest color is returned. Example
Dim MyRoad As Road Dim SplitColor As Integer
Road
Page 26-2
SplitColor = MyRoad.GetColor(ptSplitPointAttr)
SetColor Parameters
AttributeType As Integer, ColorValue As Integer
Description This method sets the color of the specified attribute of the Road. The attribute is specified by one of constants ptCenterLineAttr, ptSplitPointAttr, ptReferencePointAttr, andptSlopeInterceptAttr.The color is a sequence number in the standard palette of 256 colors. Example
Dim MyRoad As Road Dim SplitColor As Integer MyRoad.SetColor ptSplitPointAttr, SplitColor
GetProfileData Parameters
NumberOfIPs As Long, IPs() As ProfileElement
Description GetProfileData returns the data of the profile of the Road. If the road has no profile, then NumberOfIPs will be = 0. The starting chainage of the road is taken into account. Example
Dim Dim Dim Dim Dim Dim Dim Dim Dim Dim A As Application Doc As Document Sel As Selection Obj As CadObject oRoad As Road IPs() As ProfileElement NrOfIPs As Long, i As Long MyDialogs As Dialogs FileName As String BCx As String, BCy As String, ECx As String, ECy As String
Redim IPs(1 To 5) Set A = New Application A.GetActiveDocument Doc If Not (Doc Is Nothing) Then Doc.GetSelection Sel If Sel.Count(ptRoad) = 1 Then A.GetDialogs MyDialogs Open "ProfileReport.txt" For Output As #1 Sel.GetFirst ptRoad, Obj Obj.GetRoad oRoad oRoad.GetProfileData NrOfIPs, IPs Print #1, "BC x"; Tab(8); "z"; Tab(16); "EC x"; Tab(24); "z" For i = 1 To NrOfIPs BCx = Format(IPs(i).BC.x, "###.00") BCy = Format(IPs(i).BC.y, "###.00") ECx = Format(IPs(i).EC.x, "###.00") ECy = Format(IPs(i).EC.y, "###.00") Print #1, BCx; Tab(8); BCy; Tab(16); ECx; Tab(24); ECy Next i Close #1 MyDialogs.RequestTextFileView "ProfileReport.txt" End If End If
GetHorizontalAlignmentData Parameters
NumberOfIPs As Long, IPs() As HorizontalTransition
Road
Page 26-3
Description GetHorizontalAlignmentData returns the data of the horizontal alignment of the Road. Example
Dim Dim Dim Dim Dim Dim Dim A As Application Doc As Document Sel As Selection Obj As CadObject oRoad As Road IPs() As HorizontalTransition NrOfIPs As Long
Set A = New Application A.GetActiveDocument Doc If Not (Doc Is Nothing) Then Doc.GetSelection Sel If Sel.Count(ptRoad) = 1 Then Sel.GetFirst ptRoad, Obj Obj.GetRoad oRoad oRoad.GetHorizontalAlignmentData NrOfIPs, IPs End If End If
GetSuperElevationData Parameters
NumberOfIPs As Long, IPs() As SuperElevationData
Description GetSuperElevationData returns the data of the superelevation data of the Road. Example
Dim Dim Dim Dim Dim Dim Dim A As Application Doc As Document Sel As Selection Obj As CadObject oRoad As Road IPs() As SuperElevationData NrOfIPs As Long
Set A = New Application A.GetActiveDocument Doc If Not (Doc Is Nothing) Then Doc.GetSelection Sel If Sel.Count(ptRoad) = 1 Then Sel.GetFirst ptRoad, Obj Obj.GetRoad oRoad oRoad.GetSuperElevationData NrOfIPs, IPs End If End If
GetRD_CrossSectionPositions Parameters
NumberOfCrossSections As Long, Positions() As Double
Description GetRD_CrossSectionPositions returns the chainage of each cross section (also called marker) that is defined in road design mode. If the road has no cross section markers, then NumberOfCrossSections will be = 0. The starting chainage of the road is taken into account. Example
Dim Dim Dim Dim Dim A As Application Doc As Document Sel As Selection Obj As CadObject oRoad As Road
Road
Page 26-4
Dim NrOfXSections As Long Dim Positions() As Double Redim Positions(1 To 5) Set A = New Application A.GetActiveDocument Doc If Not (Doc Is Nothing) Then Doc.GetSelection Sel If Sel.Count(ptRoad) = 1 Then Sel.GetFirst ptRoad, Obj Obj.GetRoad oRoad oRoad.GetRD_CrossSectionPositions NrOfXSections, Positions End If End If
GetRD_ReferenceObjects Parameters
NumberOfReferences As Long, References() As CadObject
Description GetRD_ReferenceObjects returns all the referenced objects that are displayed in the profile window. If the road has no profile, then NumberOfReferences will be = 0. Example
Dim Dim Dim Dim Dim Dim Dim A As Application Doc As Document Sel As Selection Obj As CadObject oRoad As Road NumberOfReferences As Long References() As CadObject
Redim References(1 To 5) Set A = New Application A.GetActiveDocument Doc If Not (Doc Is Nothing) Then Doc.GetSelection Sel If Sel.Count(ptRoad) = 1 Then Sel.GetFirst ptRoad, Obj Obj.GetRoad oRoad oRoad.GetRD_ReferenceObjects NumberOfReferences, References End If End If
GetCenterLine Parameters
NumberOfElements As Long, Elements() As PathElement
Description GetCenterLine gets the center line of the road as an array of values of the type PathElement. Each element represents a line element: Line, Arc, or Clothoid. Objects in the array are in the same sequence as the corresponding elements of the center line of the road. Example
Dim Dim Dim Dim Dim Dim Dim Dim Dim Dim A As Application Doc As Document Sel As Selection NrOfPs As Long Ps As PathElement MyDialogs As Dialogs R As Road Obj As CadObject i As Integer Str As String
Road
Page 26-5
Set A = New Application A.GetActiveDocument Doc If Not (Doc Is Nothing) Then Doc.GetSelection Sel If Sel.Count(ptRoad) = 1 Then Sel.GetFirst ptRoad, Obj Obj.GetRoad R A.GetDialogs MyDialogs Open "CenterLineReport.txt" For Output As #1 R.GetCenterLine NrOfPs, Ps For i = 1 To NrOfPs Select Case Ps(i).ElementType Case ptLine Str = "Line: (" _ & CStr(Ps(i).Line.BeginPoint.x) & "," _ & CStr(Ps(i).Line.BeginPoint.y) & "), (" _ & CStr(Ps(i).Line.EndPoint.x) & "," _ & CStr(Ps(i).Line.EndPoint.y) & ")" Case ptArc Str = "Arc: (" & CStr(Ps(i).Arc.Center.x) & "," & _ CStr(Ps(i).Arc.Center.y) & ")" Case ptClothoid Str = "Clothoid..." End Select Print #1, Str Next i Close #1 MyDialogs.RequestTextFileView "CenterLineReport.txt" End If End If
CDZtoXYZ Parameters
Chainage As Double, Distance As Double, DeltaZ As Double, _ Pnt As XY, Z As Double
Description CDZtoXYZ converts the values Chainage, Distance and DeltaZ, to coordinates. On entry DeltaZ must be the elevation relative to the profile. The starting chainage of the road will be taken into account. The returned elevation will be: Z = DeltaZ + zProfile(Chainage). Example
Dim Dim Dim Dim Dim Dim Dim Dim A As Application Doc As Document Sel As Selection Obj As CadObject R As Road Pnt As XY Pnt3D As XYZ C As Double, D As Double, Z As Double
Set A = New Application A.GetActiveDocument Doc Doc.GetSelection Sel If Sel.Count(ptRoad) = 1 Then Sel.GetFirst ptRoad, Obj Obj.GetRoad R R.CDZtoXYZ 70.0, 5.0, 1.5, Pnt, Z MsgBox "X = " & Format(Pnt.x, "###.000") & vbNewLine & _ "Y = " & Format(Pnt.Y, "###.000") & vbNewLine & _ "Z = " & Format(Z, "###.000") & vbNewLine Pnt3D.x = Pnt.x Pnt3D.y = Pnt.y Pnt3D.z = Z R.XYZtoCDZ Pnt3D, C, D, Z
Road
Page 26-6
MsgBox "C = " & Format(C, "###.000") & vbNewLine & _ "D = " & Format(D, "###.000") & vbNewLine & _ "Z = " & Format(Z, "###.000") & vbNewLine End If
XYZtoCDZ Parameters
Pnt As XYZ, Chainage As Double, Distance As Double, DeltaZ As Double
Description XYZtoCDZ converts the coordinates of a point to the values Chainage, Distance and DeltaZ. On return DeltaZ will be the elevation relative to the profile. The starting chainage of the road will be taken into account. Example
See CDZtoXYZ.
Road
Page 26-7
Chapter 27 - Polygon
Description A Polygon is a CadObject. A new Polygon can be created with the Overlay method CreatePolygon. A reference to an existing Pythagoras Polygon can be obtained e.g. with the method GetPolygon. Example See method CreatePolygon of the object type Overlay Properties
Color Comment Link DisplayLevel GroupId Layer Overlay CanBeDeleted CanChangeOverlay ObjectReference Selected Flagged Container Data NrOfObjects Pattern Border Opaque BackgroundColor BackgroundPattern Scale Area Perimeter TotalSlopeLength GetDocument GetSubDocument SetData DeleteData GetCadObject GetPolygonObjects AlignPolygon GetPolygonAlignment PointInsidePolygon
Methods
Properties
For a description of the properties Color, TrueColor, Comment, Link, DisplayLevel, GroupId, Layer, Overlay, CanBeDeleted, CanChangeOverlay, ObjectReference, Selected, Flagged, Container, Data, GetQueryData see object type CadObject. NrOfObjects Returns
Integer
Description This property returns the number of objects (points, arcs or clothoids) which make up the polygon. The first point is included also as last point. So a square polygon consists of 5 objects. Example
Dim Poly As Polygon Dim NrOfObjects As Double Page 27-1
Polygon
NrOfObjects = Poly.NrOfObjects
Pattern Returns
Style
Description The property Pattern sets or returns the hatching of the polygon. See also the constants Polygon : StyleId Example
Dim Poly As Polygon Dim NewStyle As Style With NewStyle .Symbol = True .Group = "Test" .Item = "Horizontal" End With Poly.Pattern = NewStyle
Border Returns
Integer
Description Sets or returns the border of the polygon. Border = ptNoBorder: The polygon is filled / will be filled normal (not only a border). Border = ptBorder1mm .. ptBorder10mm: The width of the border of the polygon is / will be from 1 mm up to 10 mm depending on the value of the parameter. Border = ptBorder1mmOpen .. ptBorder10mmOpen : The width of the border of the polygons is / will be from 1 mm up to 10 mm depending on the value of the parameter. The last leg of the polygon is left open. Example
Dim Poly1 As Polygon, Poly2 As Polygon Poly1.Border = ptBorder5mm Poly2.Border = Poly1.Border
Opaque Returns
Boolean
Description Sets or returns the attribute Opaque of the Polygon. If Opaque = True, then the polygon will be opaque. Example
Dim Poly1 As Polygon, Poly2 As Polygon Poly1.Border = ptBorder5mm Poly2.Opaque = Poly1.Opaque
BackgroundColor Returns
Integer
Description Sets or returns the background color of the Polygon. The background color corresponds to a color number of the systems color palette. Setting the background color has only effect if the type of background is set. Example
Dim Poly As Polygon
Polygon
Page 27-2
BackgroundPattern Returns
Integer
Description Sets or returns the background pattern of the Polygon The background pattern corresponds to a number indicating a specific polygon pattern. (See Polygon : styleId). Only the values ptNoFill, ptSolidFill, ptGrayxx (xx = 75, 50, 25 or 12) are valid background patterns. Example
Poly.BackgroundPattern = ptGray12
Scale Returns
Double
Description Sets or returns the scale of the hatching pattern of the Polygon. The scale is expressed in %. Example
Dim Poly1 As Polygon, Poly2 As Polygon Poly1.Scale = 150.0 Poly2.Scale = Poly1.Scale
Area Returns
Double
Perimeter Returns
Double
TotalSlopeLength Returns
Double
Description Returns the sum of the slope lengths of all elements of the Polygon. Example
Dim Poly As Polygon MsgBox "Perimeter = " & Poly.Perimeter & " m"
Polygon
Page 27-3
Centroid Returns
XY
Methods
CadObjects can not be assigned to objects of a specific type. So the statement : Set L = Obj is not valid. In stead, the statements GetPoint, GetLine, etc. need to be used. For a description of the methods GetDocument, GetSubDocument, SetData, DeleteData see object type CadObject. GetCadObject Parameters
Obj As CadObject
Description GetCadObject sets the reference to the Line in a variable of type CadObject. Note that the reference is copied, not the object. Example
Dim Obj As CadObject Dim MyCircle As Circle MyCircle.GetCadObject Obj ' Same as : Set Obj = MyCircle
GetPolygonObjects Parameters
Objects() As CadObject
Description GetPolygonObjects returns an array of variables of type CadObject. This array contains all objects of the polygon (Point, Arc, Clothoid) in the same sequence as they appear in the polygon. On return, the dimension of the array is always (1 To NrOfObjects). Example
Dim Dim Dim Dim Dim Dim Dim Dim A As Application D As Document Sel As Selection Counter As Long NrPoints As Long, NrArcs As Long, NrClothoids As Long Obj As CadObject Objs() As CadObject Poly As Polygon
Set A= New Application A.GetActiveDocument D D.GetSelection Sel If Sel.Count(ptPolygon) = 1 then Sel.GetFirst ptPolygon, Obj Obj.GetPolygon Poly Redim Objs(1 To Poly.NrOfObjects) Poly.GetPolygonObjects Objs
Polygon
Page 27-4
For Counter = 1 TO Poly.NrOfObjects Select case Objs(Counter).ObjectType case ptPoint NrPoints = NrPoints + 1 case ptArc NrArcs = NrArcs + 1 case ptClothoid NrClothoids = NrClothoids + 1 case else end select Next counter MsgBox "Points : " & NrPoints & VBCRLF & "Arcs : " & NrArcs & VBCRLF & _ "Clothoids : " & NrClothoids Else MsgBox "Select 1 Polygon" End If
AlignPolygon Parameters
Horizontal As Boolean, Origin As XY, Angle As Double
Description Aligns the hatching of the polygon. If Horizontal = True, then the hatching will become horizontal to the page and have an absolute origin which is the same for all unaligned hatchings. In this case, the other parameters are ignored. If Horizontal = False, then the origin of the hatching is defined by the parameter Origin, and the angle by the parameter Angle. Example
Const pi = 3.1416 Dim Org As XY Dim Poly As Polygon Org.X = 10.0 Org.Y = 10.0 Poly.AlignPolygon False, Org, 45.0/180.0*pi
GetPolygonAlignment Parameters
Horizontal As Boolean, Origin As XY, Angle As Double
Description This method returns the alignment of the hatching of the polygon. For more details of the parameters see method AlignPolygon. Example
Dim Dim Dim Dim Org As XY Angle As Double Poly As Polygon Horizontal As Boolean
PointInsidePolygon Parameters
Pos As XY
Description This method returns one of the following values : ptInside, ptOutside, ptOnEdge, ptOnVertex.
Polygon
Page 27-5
Example
Polygon
Page 27-6
Chapter 28 - Image
Description An Image is a CadObject. A new Image object can be created with the Overlay method CreateImage. A reference to an existing Pythagoras Image can be obtained with e.g. the method GetImage. Example
See ConvertImage Color Comment Link DisplayLevel GroupId Layer Overlay CanBeDeleted CanChangeOverlay ObjectReference Selected Flagged Container Data Monochrome ColorDepth Width Height DPMx DPMy WidthInPixels HeightInPixels Position FileName NameRelative Intensity Inverted Transparent GetDocument GetSubDocument SetData DeleteData GetCadObject SetReduce_Enlarge GetReduce_Enlarge SetScale GetScale GetOrientation SetOrientation PixelRect PositionRect ImageData ImageDataSize
Properties
Methods
Properties
For a description of the properties Color, TrueColor, Comment, Link, DisplayLevel, GroupId, Layer, Overlay, CanBeDeleted, CanChangeOverlay, ObjectReference, Selected, Flagged, Container, Data, GetQueryData see object type CadObject.
Image
Page 28-1
Monochrome Returns
Boolean
ColorDepth Returns
Integer
Description This property returns one of the following values : ptMonochrome, ptPalet256, ptTrueColor. Example
Dim I As Image If I.ColorDepth = ptTrueColor Then 'Do Something End If
Description These properties return the width / height of the original unscaled image in paper dimensions. This value is calculated by Pythagoras based on the DPI and on the number of pixels of the image. Example
Dim I As Image Dim W As Double Dim H As Double W = I.Width H = I.Height
Description These properties return the resolution at which the image was scanned expressed in dots (pixels) per meter. Example
Dim I As Image Dim DPMx As Double Dim DPMy As Double DPMx = I.DPMx DPMy = I.DPMy
Image
Page 28-2
Description These properties return the number of pixels of the image. Example
Dim I As Image Dim x As Long Dim y As Long x = I.WidthInPixels y = I.HeightInPixels
Position Returns
XY
Description This property returns the position of the top-left corner of the image. Possible clipping is not taken into account. If required see method PositionRect. Example
Dim I As Image Dim Pnt As XY Pnt = I.Position
FileName Returns
String
Description This property returns the name of the .img file as stored in the document. If the name refers to an .img file, the name can contain either the full path name, or a relative name. If the image is stored in the Pythagoras document, this property returns the short name (without path) of the original image file. Example
Dim I As Image Dim Name As String Name = I.FileName
NameRelative Returns
Boolean
Description This property returns True if the name of the .img file is not a full path name. When setting this property to True, the full path name will be made relative. Example
Dim I As Image Dim Name As String If I.NameRelative = False Then I.NameRelative = True End If
Intensity Returns
Integer
Description This property sets or returns the intensity at which the image is displayed and printed. The intensity must be a value between 1 and 100.
Image
Page 28-3
Example
Inverted Returns
Boolean
Description This property sets or returns the invert image attribute. This property may only be used on monochrome images. Example
Dim I As Image If I.Monochrome = True Then I.Inverted = True End If
Transparent Returns
Boolean
Description This property sets or returns the attribute that controls if the image is either transparent or opaque. Example
Dim I As Image If I.Transparent = True Then I.Transparent = False End If
Methods
CadObjects can not be assigned to objects of a specific type. So the statement : Set P = Obj is not valid. In stead, the statements GetPoint, GetLine, etc. need to be used. For a description of the methods GetDocument, GetSubDocument, SetData, DeleteData see object type CadObject. GetCadObject Parameters
Obj As CadObject
Description GetCadObject sets the reference to the Image in a variable of type CadObject. Note that the reference is copied, not the object. Example
Dim Obj As CadObject Dim I As Image I.GetCadObject Obj ' Same as : Set Obj = I
SetReduce_Enlarge Parameters
ScaleX As Double, ScaleY As Double
Description SetReduce_Enlarge sets the new scale factors (X and Y) of the image. So the old scale factors have no effect on the result. The scale factors are expressed in %. Image
Page 28-4
Example
GetReduce_Enlarge Parameters
ScaleX As Double, ScaleY As Double
Description GetReduce_Enlarge returns both the factors (X and Y) by which the image is scaled. The scale factors are expressed in %. Example
Dim I As Image Dim ScaleX As Double, ScaleY As Double I.SetReduce_Enlarge ScaleX, ScaleY
SetScale Parameters
ScaleDependent As Boolean, Scale As Double
Description SetScale sets the real scale of the image, e.g. at 1/10000, if the parameter ScaleDependent is set True. If the parameter ScaleDependent is False, the scale is ignored and the size of the image when printed will depend on the DPM, the number of pixels and on the Enlarge_Reduce factors. Example
Dim I As Image Dim ScaleDependent As Boolean Dim Scale As Double I.GetScale ScaleDependent, Scale
GetScale Parameters
ScaleDependent As Boolean, Scale As Double
Description GetScale returns the real scale of the image, if the parameter ScaleDependent is returned True. If the parameter ScaleDependent returns False, the returned scale = 0.0. Example
Dim I As Image Dim ScaleDendent As Boolean Dim Scale As Double I.GetScale ScaleDependent, Scale
GetOrientation Parameters
Oblique As Boolean, Angle As Double
Description GetOrientation returns the angle of the image if the parameter Oblique returns True. The variable Oblique returns False if the image is horizontal. In that case the returned angle is also equal to zero. Example
Dim I As Image Dim Oblique As Boolean, Angle As Double I.GetOrientation Oblique, Angle
Image
Page 28-5
SetOrientation Parameters
Oblique As Boolean, Angle As Double
Description SetOrientation sets the angle of the image if the image is oblique. The parameter Oblique must be set False if the image must remain horizontal. In that case the value of the parameter angle is ignored. Example
Const pi = 3.1416 Dim I As Image I.SetOrientation True, 90.0/360.0 * pi
Description This property returns the rectangle {1.0, 1.0, WidthInPixels, HeightInPixels}. If the parameter Clipped is true, the rectangle of the clipped image as seen by the user is returned. So {1.0, 1.0, Width, Height} where Width and Height are the number of pixels of the clipped image. Example
Dim I As Image Dim Rect As Rectangle Rect = I.PixelRect
Description This property returns in the position of the top-left and bottom-right pixels of the image in the drawing. This property is mainly intended for obtaining the position of georeferenced imaged. For other images a rectangle is returned anyway. For images that are not scale dependent (see methods SetScale and GetScale), the property will return the rectangle of the image on the active sheet. If the parameter Clipped is true, the rectangle of the clipped image as seen by the user is returned. Example
Dim I As Image Dim Rect As Rectangle Rect = I.PositionRect
ImageData Parameters
ColorDepth As Integer, Rect As Rectangle, UpsideDown As Boolean, ApplyImageOperations As Boolean, Data() As Byte
Description ImageData returns the raw bytes of the image. The parameter ColorDepth (ptMonochrome, ptPalet256, ptTrueColor) must be the same or have a higher value than the colordepth of the image. If ptTrueColor, Data contains three bytes per pixel. Sequence: R, G, B. Image
Page 28-6
A ptPalet256 image can be obtained either as a ptPalet256 or ptTrueColor image. A ptMonochrome image can be obtained in all 3 formats. The parameter Rect specifies the part of the image that must be read. The value of x1 and y1 must be >= 0. If x2 or y2 of the rectangle is >= than respectively the width or height of the image, the data is padded with white. If UpsideDown = True, the bottom line will be first, and the top line will be last. If ApplyImageOperations is True, the image as it visible on the screen will be returned. In that case the parameter Rect is applied to the clipped image. In other words, point (1.0, 1.0) is the top left point of the clipped image. Example
Dim I As Image Dim ImageData() As Byte Redim ImageData(1 To I.ImageData(ptTrueColor, I.PixelRect)) I.ImageData ptTrueColor, I.PixelRect, False, ImageData
Description ImageDataSize returns the number of bytes required to retrieve the part Rect at the given ColorDepth the image. The parameters ColorDepth and Rect must be the same as used by subsequenct call to ImageData. If the parameter Clipped is true, the size required by the clipped image as seen by the user is returned. See also method ImageData parameter ApplyImageOperations. Example
See ImageData.
Image
Page 28-7
Chapter 29 - Compound
Description A Compound is a CadObject, that groups a number of other Cad objects. A Compound can be created with the Overlay method CreateCompound. Only the Cad object types Point, Line, Arc, Circle, Curve, Clothoid, Text, Richtext, Path, Polygon and Image can be elements of a compound. All objects in a Compound must be in the same Overlay and in the same Subdocument. If the objects are in the overlay ptPaper, the objects must be in the same Sheet. Example
Dim Dim Dim Dim Dim Dim Dim Dim A As Application Doc As Document Drawing As Overlay Position As XYZ C As Compound P1 As Point P2 As Point P3 As Point
Set A = New Application A.GetActiveDocument Doc Doc.GetOverlay ptDrawing, Drawing Position.X = -1. Position.Y = 0. Position.Z = 0. Drawing.CreatePoint Position, P1 Position.X = 1. Drawing.CreatePoint Position, P2 Position.X = 0. Position.Y = 2. Drawing.CreatePoint Position, P3 Drawing.CreateCompound C Set P1.Container = C ' Add point P1 to compound C MsgBox "A compound contains " & C.NrOfElements & " elements" Set P2.Container = C ' Add two more points to compound C Set P3.Container = C MsgBox "A compound contains " & C.NrOfElements & " elements" Set P1.Container = Nothing ' Exclude point P1 from MsgBox "A compound contains " & C.NrOfElements & " elements"
Properties
Overlay ObjectReference Data NrOfElements GetDocuments GetSubDocument GetCadObject SetData DeleteData GetElements
Methods
Properties
For a description of the properties Overlay, CanChangeOverlay, Data, GetQueryData see object type CadObject. The properties Layer is read-only. It returns an empty string. NrOfElements Returns
Integer
Compound
Page 29-1
Methods
CadObjects can not be assigned to objects of a specific type. So the statement : Set C = Obj is not valid. In stead, the statements GetPoint, GetLine, etc. need to be used. For a description of the methods GetDocument, GetSubDocument, GetCadObject, SetData, DeleteData see object type CadObject. GetElements Parameters
Objs() As CadObject
Description GetElements returns the list of all members (CadObjects) in the compound. If there are no elements in the compound, an empty array is returned. Example
Dim Objs() As CadObject Dim C As Compound C.GetElements Objs
Compound
Page 29-2
Chapter 30 - CoordinateSystem
Description A CoordinateSystem is either a CadObject, in which case it is a user defined coordinate system or the coordinate system Local, Global, Page or Temporary coordinate system. A CoordinateSystem can be obtained with the Document method GetActiveCoordinateSystem, with the CadObject method GetCoordinateSystem, or by running through the object CoordinateSystems (GetFirst and GetNext). Example
Dim A As Application Dim Doc As Document Dim CS As CoordinateSystem Set A = New Application A.GetActiveDocument Doc Doc.GetActiveCoordinateSystem CS MsgBox CS.Name
Properties
Methods
Properties
Overlay Returns
Integer
Description This property returns the type of overlay of the coordinate system. The value is either ptDrawing or ptPaper. Example
Dim CS As CoordinateSystem If CS.Overlay = ptPaper Then End If
TypeOfCS Returns
Integer
Description This property returns one of the following values : ptLocalCS, ptUserCS, ptGlobalCS, ptPageCS, ptTempCS. Example
Dim CS As CoordinateSystem If CS.TypeOfCS = ptUserCS Then MsgBox "User coordinate system is active" End If
CoordinateSystem
Page 30-1
Name Returns
String
Description This property returns the name of the coordinate system. Example
Dim A As Application Dim Doc As Document Dim CS As CoordinateSystem Set A = New Application A.GetActiveDocument Doc Doc.GetActiveCoordinateSystem CS MsgBox CS.Name
Origin Returns
XY
Description This property returns the origin (x, y) of the coordinate system. Example
Dim CS As CoordinateSystem Dim Pnt As XY Pnt = CS.Origin
ZOfOrigin Returns
Double
XAxisPnt Returns
XY
Description This property returns a point on the X-axis of the coordinate system. Example
Dim CS As CoordinateSystem Dim Pnt As XY Pnt = CS.XAxisPnt
YAxisPnt Returns
XY
Description This property returns a point on the Y-axis of the coordinate system. Example
Dim CS As CoordinateSystem Dim Pnt As XY
CoordinateSystem
Page 30-2
Pnt = CS.YAxisPnt
TransformationParameters Returns
Transformation
Description This property returns the transformation parameters. These transformation parameters can directly be used to convert local coordinates to coordinates in the coordinate system or vice versa. For more information about the data type and its use, see Pythagoras Data Type Transformation, and the object Units. Example
Dim CS As CoordinateSystem Dim TrPars As Transformation Dim U As Units TrPars = CS.TransformationParameters Set U = New Units U.SetTransformation TrPars
Methods
SetActive Parameters
CS As CoordinateSystem
Description SetActive makes the coordinate system the active one. Example
Dim CS As CoordinateSystem CS.SetActive
CoordinateSystem
Page 30-3
Chapter 31 - CoordinateSystems
Description CoordinateSystems is the set of all coordinate systems. This Object allows enumerating all coordinate systems in either the paper or drawing overlay. CoordinateSystems is obtained from the object Overlay by using the method GetCoordinateSystems. Example
Dim Dim Dim Dim Dim Dim A As Application Doc As Document Ovl As Overlay CSs As CoordinateSystems CS As CoordinateSystem i As Integer
Set A = New Application A.GetActiveDocument Doc Doc.GetOverlay ptDrawing, Ovl Ovl.GetCoordinateSystems CSs CSs.GetFirst CS For i = 1 To CSs.NrOfCoordinateSystems MsgBox CS.Name CSs.GetNext CS Next i
Properties Methods
Properties
NrOfCoordinateSystems Returns
Integer
Description This property returns the number of coordinate systems in the set. Example
See introduction.
Methods
GetFirst Parameters
CS As CoordinateSystem
Description GetFirst returns the first coordinate system in the set. Example
See introduction.
GetNext Parameters
CS As CoordinateSystem
CoordinateSystems
Page 31-1
Example
See introduction.
CoordinateSystems
Page 31-2
Chapter 32 - CoordinateReferenceSystem
Description A CoordinateReferenceSystem is either a geographical reference system (e.g. WGS84) or a specific projection system applied to a geographical reference system (e.g. Belgian Lambert 72). The CoordinateReferenceSystem can be obtained from CoordinateReferenceSystems using the methods GetFirst, GetNext, GetCoordinateReferenceSystem . Example
Dim A As Application Dim CRSs As CoordinateReferenceSystems Dim CRS As CoordinateReferenceSystem Set A = New Application A.GetCoordinateReferenceSystems CRSs CRSs.GetCoordinateReferenceSystem "UTM Z31", CRS
Properties
Methods
Properties
Name Returns
String
Description This property returns the name that identifies the CoordinateReferenceSystem. Each CRS has a unique name independent of the language version of Pythagoras. Example
Dim CRS As CoordinateReferenceSystem MsgBox CRS.Name
LocalName Returns
String
Description This property returns the localised name of the CoordinateReferenceSystem. The local name name depends on the language version of Pythagoras. The local name is used in dialog boxes in Pythagoras. Example
Dim CRS As CoordinateReferenceSystem MsgBox CRS.LocalName
ShortName Returns
String
Description This property returns the short name of the CoordinateReferenceSystem. The short name depends on the language version of Pythagoras. The short name is used in the control panel. Example
Dim CRS As CoordinateReferenceSystem
CoordinateReferenceSystem
Page 32-1
MsgBox CRS.ShortName
CRSType Returns
Integer
This property can be used to find out if a Coordinate Reference System is either only a Geographical Coordinate System returning Latitude,Longitude or a Projection System based on a Geographical Coordinate System. Example
Dim CRS As CoordinateReferenceSystem If CRS.CRSType = ptGeographical Then MsgBox "Please use Latitude/Longitude" End If
Methods
TransformXYTo Parameters
DestinationCRS As CoordinateReferenceSystem, Pnt As XY, Optional Transformation As HelmertTransformation, Optional SmoothResiduals As Integer XY
Returns
Description TransformXYTo transforms the coordinates Pnt from the current CRS to the DestinationCRS. For geographical systems, XY is used to pass/return the latitude, longitudevalues. These angle values must be passed in degrees decimal. Sequence: x = latitude, y = longitude. For projection systems the (x,y) coordinates are passed/returned in meter. Example
Dim Dim Dim Dim Dim Dim A As Application CRSs As CoordinateReferenceSystems SourceCRS As CoordinateReferenceSystem DestinationCRS As CoordinateReferenceSystem Pnt As XY UTMCoord As XY
set A = New Application A.GetCoordinateSystems CRSs CRSs.GetCoordinateReferenceSystem "WGS84", SourceCRS CRSs.GetCoordinateReferenceSystem "UTM N Z31", DestinationCRS Pnt.x = 51.3146424 'Latitude Pnt.y = 4.8776564 'Longitude If SourceCRS.TransformToPossible(DestinationCRS) then UTMCoord = SourceCRS.TransformXYTo(DestinationCRS, Pnt) End if
TransformToPossible Parameters
CRS As CoordinateReferenceSystem
CoordinateReferenceSystem
Page 32-2
Returns
Boolean
CoordinateReferenceSystem
Page 32-3
Chapter 33 - CoordinateReferenceSystems
Description CoordinateReferenceSystems is the set of all Coordinate Reference Systems. This Object allows enumerating all coordinate reference systems. CoordinateReferenceSystems is obtained from the object Application by using the method GetCoordinateReferenceSystems. Example
Dim A As Application Dim CRSs As CoordinateReferenceSystems Dim CRS As CoordinateReferenceSystem Set A = New Application A.GetCoordinateReferenceSystems CRSs CRSs.GetFirst CRS Do While Not (CRS is Nothing) MsgBox CRS.Name & vbCrLf & CRS.LocalName CRSs.GetNext CRS Loop
Properties Methods
Properties
NrOfCoordinateReferenceSystems Returns
Long
Description This property returns the total number of Coordinate Reference Systems. Example
Dim A As Application Dim CRSs As CoordinateReferenceSystems Set A = New Application A.GetCoordinateReferenceSystems CRSs MsgBox CRSs.NrOfCoordinateReferenceSystems
Methods
GetFirst Parameters
CRS As CoordinateReferenceSystem
GetNext Parameters
CRS As CoordinateReferenceSystem
Example
See introduction.
GetCoordinateReferenceSystem Parameters
Name As String CRS As CoordinateReferenceSystem
Description GetCoordinateReferenceSystem returns the coordinate reference system with the given name. If a CRS with the given name does not exist, the return value CRS will be equal to Nothing. Example
Dim A As Application Dim CRSs As CoordinateReferenceSystems Dim CRS As CoordinateReferenceSystem Set A = New Application A.GetCoordinateReferenceSystems CRSs CRSs.GetCoordinateReferenceSystem "UTM N Z32", CRS If CRS Is Nothing Then MsgBox "CRS does not exist" End If
CoordinateReferenceSystems
Page 33-2
Chapter 34 - TiePointsSetCollection
Description TiePointsSetCollection is the collection of all TiePointsSets in either a document or in the system Library. This Object allows enumerating allTiePointsSets. TiePointsSetCollection is obtained from the object Documentor from Application by using the method GetTiePointsSetCollection. Example
Dim A As Application Dim TPC As TiePointsSetCollection Dim TPS As TiePointsSet Set A = New Application A.GetTiePointsSetCollection TPC TPC.GetFirst TPS Do While Not (TPS is Nothing) MsgBox TPS.Name TPC.GetNext TPS Loop
Properties Methods
Properties
Count Returns
Integer
Description This property returns the number of Tie Points Sets in the collection. Example
Dim Doc As Document Dim TPC As TiePointsSetCollection Doc.GetTiePointsSetCollection TPC MsgBox TPC.Count
Methods
GetFirst Parameters
TPS As TiePointsSet
Description GetFirst returns the first set of tie points in TiePointsCollection. Example
See introduction.
GetNext Parameters
TPS As TiePointsSet
TiePointsSetCollection
Page 34-1
Description GetNext returns the next set of tie points in the collection of Tie Point Set. Example
See introduction.
GetTiePointsSet Parameters
Name As String TPS As TiePointsSet
Description GetTiePointSet returns the set of tie points with the given name. If a set with the given name does not exist, the return value will be equal to Nothing. Example
Dim A As Application Dim TPC As TiePointsSetCollection Dim TPS As TiePointsSet Set A = New Application A.GetTiePointsSetCollection TPC TPS = TPC.GetTiePointsSet "Test1", TPS If TPS Is Nothing Then MsgBox "Tie points set does not exist" End If
TiePointsSetCollection
Page 34-2
Chapter 35 - TiePointsSet
Description A TiePointsSet is set of pairs of coordinates in different projection systems for the same geographical point. Such set can be used for improvement the accuracy of transformation between the different projection systems. The TiePointsSet can be obtained from TiePointsCollection using the methods GetFirst, GetNext. Example
Dim A As Application Dim TPC As TiePointsSetCollection Dim TPS As TiePointsSet Set A = New Application A.GetTiePointsSetCollection TPC TPC.GetTiePointsSet "Test1", TPS If TPS Is Nothing Then MsgBox "Tie points set does not exist" End If
Properties
Methods
Properties
Name Returns
String
Description This property returns the name that identifies the TiePointsSet. Example
Dim TPS As TiePointsSet MsgBox TPS.Name
NrOfElements Returns
Integer
Description This property returns the number of points (pairs) in the TiePointsSet. Example
Dim TPS As TiePointsSet MsgBox TPS.NrOfElements
CRSFrom Returns
CoordinateReferenceSystem
Description This property return theCoordinate reference system of the first point of each pair in the TiePointsSet.
TiePointsSet
Page 35-1
Example
Dim TPS As TiePointsSet Dim CRS As CoordinateReferenceSystem Set CRS = TPS.CRSFrom MsgBox CRS.Name
CRSTo Returns
CoordinateReferenceSystem
Description This property return theCoordinate reference system of the second point of each pair in the TiePointsSet. Example
Dim TPS As TiePointsSet Dim CRS As CoordinateReferenceSystem Set CRS = TPS.CRSTo MsgBox CRS.Name
Methods
GetFirstElement Parameters
None
Returns
Description Returns the first element of the tie points set. Example
Dim Dim Dim Dim TPS As TiePointsSet Ident As String P1 As XY P2 As XY
TPS.GetFirstElement Ident, P1, P2 Do While Not (Ident = "") MsgBox Ident & " " & CStr(P1.x) & " TPS.GetNextElement Ident, P1, P2 Loop
GetNextElement Parameters
None
Returns
Description Returns the next element of the tie point set Example
See GetFirstElement
TiePointsSet
Page 35-2
Set A = New Application A.GetActiveDocument Doc1 Doc1.GetSelection SelectionDoc1 Doc1.GetFlaggedObjects FlaggedObjectsDoc1 Doc1.GetOverlay ptDrawing, DrawingOverlay DrawingOverlay.GetAllObjects MyDrawing
Properties
Overlay Sheet Wallpaper NrOfObjects NrOfWholeObjects Color TrueColor ImageIntensity Comment DisplayLevel Layer PointStyle LineStyle LineWidth LineArrows TextStyle TextWeight TextPointSize TextHorizontalAlignment TextVerticalAlignment TextUnderline TextBorder TextLineSpacing TextOpaque TextOrientation TextAngle CurveCurvature CurveMaxRounding PolygonPattern
Page 36-1
Methods
Count GetFirst GetNext ChangeOverlay Copy Cut Clear Move Rotate Group Ungroup Unpack DeleteData AddAnnotation AdjustDisplayLevel SetZ ScalePoints ScaleLines ScaleTexts ScalePolygons AlignPolygons ConvertObjectsToPolylines GetFirstPoint GetNextPoint IntersectingLines Intersections UnderShoot OverShoot SetTextFont Transform ClearSet MakeSet MakeSetDB MakeSetTextual Toggle Include Exclude InSet ApplyThematics GetThematics RemoveThematics GetTerrainModel
Properties
Overlay Returns
OverlayType As Integer
Description This property returns the overlay in which the objects of the set are located. ptPaper if the Set refers to the Paper Overlay. ptDrawing if the Set refers to the Drawing Overlay. Example
Dim A As Application Dim Doc As Document Dim MyDrawing As AllObjects
Page 36-2
Dim DrawingOverlay As Overlay Dim OverlayType As Integer Set A = New Application A.GetActiveDocument Doc Doc.GetOverlay ptDrawing, DrawingOverlay DrawingOverlay.GetAllObjects MyDrawing OverlayType = MyDrawing.Overlay
Sheet Value
Sheet
Description This property may be applied only to objects of AllObjects class. The property returns a sheet the set contains objects of. If the set was defined for a whole overlay the property returns Nothing. Example
Dim All As AllObjects, Sh As Sheet Set Sh = All.Sht
Wallpaper Value
Boolean
Description Returns False if the object of class AllObjects was defined not to contain objects of wallpaper layers and subdocuments. Being applied to an object of class Selection or FlaggedObjects this property returns True. Example
Dim All As AllObjects, WP As Boolean WP = All.Wallpaper
NrOfObjects Returns
Long
Description Returns the number of elementary objects in the set.The compounds are not included, but the elements of the compounds are included. Example
Dim Dim Dim Dim Dim A As Application Doc As Document MyDrawing As AllObjects DrawingOverlay As Overlay OverlayType As Integer
Set A = New Application A.GetActiveDocument Doc Doc.GetOverlay ptDrawing, DrawingOverlay DrawingOverlay.GetAllObjects MyDrawing MsgBox "Number of objects in Drawing Overlay : " & Str(MyDrawing.NrOfObjects)
NrOfWholeObjects Returns
Long
Page 36-3
Description Returns the number of elementary plus compound objects in the set.So the elements of a compound are not included. In other words: the result is the sum of the objects not being a member of a compound plus the number of compounds. Example
Dim Dim Dim Dim Dim Dim A As Application Doc As Document MyDrawing As AllObjects DrawingOverlay As Overlay OverlayType As Integer Count As Long
Set A = New Application A.GetActiveDocument Doc Doc.GetOverlay ptDrawing, DrawingOverlay DrawingOverlay.GetAllObjects MyDrawing Count = MyDrawing.NrOfWholeObjects
Color Parameters
Color As Integer
Description Sets the color (one of the 255 predefined palette colors) of the objects in the set. The color is only changed for those object types for which the property color is applicable. When applied to Rich Texts, all characters in the rich text block will get the given color. Example
Dim Dim Dim Dim Dim A As Application Doc As Document MyDrawing As AllObjects DrawingOverlay As Overlay OverlayType As Integer
Set A = New Application A.GetActiveDocument Doc Doc.GetOverlay ptDrawing, DrawingOverlay DrawingOverlay.GetAllObjects MyDrawing MyDrawing.Color = ptBlue
TrueColor Parameters
Color As RGB
Description Sets the color (given as RGB value) of the objects in the set. The color is only changed for those object types for which the property color is applicable. When applied to Rich Texts, all characters in the rich text block will get the given color. Example
Dim Obj1 As CadObject Dim RGBColor As RGB RGBColor.Red = 120 RGBColor.Green = 250 RGBColor.Blue = 65 Obj1.TrueColor = RGBColor
ImageIntensity Parameters
Intensity As Integer
Page 36-4
Example
MyDrawing.ImageIntensity = 50
Comment Parameters
Comment As String
Description Sets the comment of all objects in the set to Comment. Example
Dim A As Application Dim Doc As Document Dim SelectedObjects As Selection Set A = New Application A.GetActiveDocument Doc Doc.GetSelection SelectedObjects SelectedObjects.Comment = "ABCD"
DisplayLevel Parameters
Level As Integer
Description Sets the display level of all objects in the set to Level. The value of DisplayLevel must be in the range -10 to 10. Example
Dim A As Application Dim Doc As Document Dim SelectedObjects As Selection Set A = New Application A.GetActiveDocument Doc Doc.GetSelection SelectedObjects SelectedObjects.DisplayLevel = 2
Layer Parameters
LayerName As String
Description Sets the Layer of all objects in the set to LayerName. If the layer does not exist, a layer with the given name will be created. This property has no effect on Compound objects. IfLayerName = "~SYSTEM~" (name of the System Layer), then the object, when it's a point, arc or clothoid, will be put in the System Layer. Trying to put other objects in the System Layer will have no effect. For more information about System Layer see chapter Layers. Example
Dim A As Application Dim Doc As Document Dim SelectedObjects As Selection Set A = New Application A.GetActiveDocument Doc Doc.GetSelection SelectedObjects SelectedObjects.Layer = "Selections"
PointStyle Parameters
NewStyle As Style
Page 36-5
Description Sets the Style of all Points in the set to NewStyle. Example
Dim Dim Dim Dim A As Application Doc As Document SelectedObjects As Selection NewStyle As Style
Set A = New Application A.GetActiveDocument Doc Doc.GetSelection SelectedObjects With NewStyle .Symbol = True .Group = "Example" .Item = "Doorstep" End With SelectedObjects.PointStyle = NewStyle
LineStyle Parameters
NewStyle As Style
Description Sets the Style of all Line type objects (Lines, Arcs, Circles, Spirals, Curves) in the set to NewStyle. Example
Dim Dim Dim Dim A As Application Doc As Document SelectedObjects As Selection NewStyle As Style
Set A = New Application A.GetActiveDocument Doc Doc.GetSelection SelectedObjects With NewStyle .Symbol = True .Group = "Example" .Item = "Wall" End With SelectedObjects.LineStyle = NewStyle
LineWidth Parameters
Width As Double
Description Sets the Width of all Line type objects (Lines, Arcs, Circles, Curves, ..) in the set to Width. Width : between 0.1 and 25.5. 1.0 = 0.1 mm, 20.0 = 2.0 mm. Example
Dim A As Application Dim Doc As Document Dim SelectedObjects As Selection Set A = New Application A.GetActiveDocument Doc Doc.GetSelection SelectedObjects SelectedObjects.LineWidth = 2.0
LineArrows Parameters
On As Boolean
Page 36-6
Description Sets or resets the line arrows at the end points of Lines, Arcs and Spirals in the set. Arrows of an object will only be set if the corresponding end points of the objects are also in the set. If On = TRUE then the arrow is set. This function behaves identically as its interactive counterpart. Example
Dim A As Application Dim Doc As Document Dim SelectedObjects As Selection Set A = New Application A.GetActiveDocument Doc Doc.GetSelection SelectedObjects SelectedObjects.LineArrows = TRUE
TextStyle Parameters
Style As Integer
Description Sets the Style of all texts in the set to Style. Style = ptUpright (= 1): Normal Style = ptItalic (= 2): Italic This property is not applicable to Rich Text objects. Example
Dim A As Application Dim Doc As Document Dim SelectedObjects As Selection Set A = New Application A.GetActiveDocument Doc Doc.GetSelection SelectedObjects SelectedObjects.TextStyle = ptItalic
TextWeight Parameters
Weight As Integer
Description Sets the Weight of all texts in the set to Weight. Weight = ptLight (= 0): Light Weight = ptMedium (= 1): Normal Weight = ptBold (= 2): Bold Weight = ptExtraBold (= 3): Extra Bold Not all fonts can be represented Light or Extra Bold. This property is not applicable to Rich Text objects. Example
Dim A As Application Dim Doc As Document Dim SelectedObjects As Selection Set A = New Application A.GetActiveDocument Doc Doc.GetSelection SelectedObjects SelectedObjects.TextWeight = ptBold
TextPointSize Parameters
PointSizeAs Integer
Page 36-7
Description Sets the point size of all texts in the set to PointSize. Value of PointSize must be between 1 and 1000. This property is not applicable to Rich Text objects. Example
Dim A As Application Dim Doc As Document Dim SelectedObjects As Selection Set A = New Application A.GetActiveDocument Doc Doc.GetSelection SelectedObjects SelectedObjects.TextPointSize = 20
TextHorizontalAlignment Parameters
Alignment As Integer
Description Sets the horizontal alignment of all texts in the set to Alignment. Alignment = ptAlignLeft(= 0): left aligned. Alignment = ptAlignCenter(= 1): centered. Alignment = ptAlignRight (= 2): right aligned. This property is not applicable to Rich Text objects. Example
Dim A As Application Dim Doc As Document Dim SelectedObjects As Selection Set A = New Application A.GetActiveDocument Doc Doc.GetSelection SelectedObjects SelectedObjects.TextHorizontalAlignment = ptAlignCenter
TextVerticalAlignment Parameters
Alignment As Integer
Description Sets the vertical alignment of all texts in the set to Alignment. Alignment = ptAlignBottom(= 0) : bottom aligned. Alignment = ptAlignCenter(= 1) : centered. Alignment = ptAlignTop (= 2) : top aligned. This property is not applicable to Rich Text objects. Example
Dim A As Application Dim Doc As Document Dim SelectedObjects As Selection Set A = New Application A.GetActiveDocument Doc Doc.GetSelection SelectedObjects SelectedObjects.TextVerticalAlignment = ptAlignTop
TextUnderline Parameters
Underline As Integer
Page 36-8
Description Sets the underlining of all texts in the set to Underline. Underline = ptUnderlineNone (= 0) : no underlining. Underline = ptUnderlineSingle (= 1) : single underlining. Underline = ptUnderlineDouble (= 2) : double underlining. Underline = ptUnderlineDashed (= 3) : underlining dashed line. This property is not applicable to Rich Text objects. Example
Dim A As Application Dim Doc As Document Dim SelectedObjects As Selection Set A = New Application A.GetActiveDocument Doc Doc.GetSelection SelectedObjects SelectedObjects.TextUnderline = ptUnderlineSingle
TextBorder Parameters
Border As Integer
Description Sets the border of all texts in the set toBorder. Border = ptBorderNone (= 0) : no border. Border = ptBorderSingle (= 1) : single border. Border = ptBorderDouble (= 2) : double border. This property is not applicable to Rich Text objects. Example
Dim A As Application Dim Doc As Document Dim SelectedObjects As Selection Set A = New Application A.GetActiveDocument Doc Doc.GetSelection SelectedObjects SelectedObjects.TextBorder = ptBorderSingle
TextLineSpacing Parameters
LineSpacing As Integer
Description Sets the spacing of all texts in the set toLineSpacing. LineSpacing = ptSpacingSmall (= 0) : small line spacing. LineSpacing = ptSpacingNormal (= 1) : normal line spacing. LineSpacing = ptSpacingLarge (= 2) : large line spacing. This property is not applicable to Rich Text objects. Example
Dim A As Application Dim Doc As Document Dim SelectedObjects As Selection Set A = New Application A.GetActiveDocument Doc Doc.GetSelection SelectedObjects SelectedObjects.TextLineSpacing = ptSpacingLarge
TextOpaque Parameters
Opaque As Boolean
Page 36-9
Description Sets all texts in the set, also rich texts, either Opaque or Transparent. Opaque = True : Opaque. Opaque = False : Transparent. Example
Dim A As Application Dim Doc As Document Dim SelectedObjects As Selection Set A = New Application A.GetActiveDocument Doc Doc.GetSelection SelectedObjects SelectedObjects.TextOpaque = True
TextOrientation Parameters
Orientation As Integer
Description Sets the orientation of all texts in the set, also rich texts, to Orientation. Orientation = ptTextHorizontal (= 0): The texts will always appear horizontal independent of page orientation or angle. Orientation = ptTextOrientationReadable (= 1) : The angle of the displayed or printed texts will change if the text would come upside down. If the angle of the texts is in 2nd or 3rd quadrant, the texts are turned over 180 degrees. Orientation = ptTextOrientationAbsolute (= 2) : The texts are always displays at the given angle. Example
Dim A As Application Dim Doc As Document Dim SelectedObjects As Selection Set A = New Application A.GetActiveDocument Doc Doc.GetSelection SelectedObjects SelectedObjects.TextAngle = 1.3 SelectedObjects.TextOrientation = ptTextOrientationReadable
TextAngle Parameters
Angle As Double
Description Sets the angle of all texts in the set, also rich texts, to Angle. The angle at which a text will be displayed will not depend of the orientation of the text set previously. TextAngle will set the orientation to ptTextOrientationAbsolute. The angle is expressed in radians. See also TextOrientation Example
See TextOrientation
CurveCurvature Parameters
Curvature As Integer
Description Sets the curvature of all curves in the set to Curvature. The curvature must have a value between 0 and 10. If Curvature = 0 then the curve is displayed as a polyline. Example
Dim A As Application Dim Doc As Document Page 36-10
Dim SelectedObjects As Selection Set A = New Application A.GetActiveDocument Doc Doc.GetSelection SelectedObjects SelectedObjects.CurveCurvature = 2
CurveMaxRounding Parameters
MaxRounding As Boolean
Description Sets the rounding of all Curves in the set. MaxRounding = True, indicates that all angles will be smoothed. This attribute has only effect on curves which contain collinear points. Example
Dim A As Application Dim Doc As Document Dim SelectedObjects As Selection Set A = New Application A.GetActiveDocument Doc Doc.GetSelection SelectedObjects SelectedObjects.CurveMaxRounding = True
PolygonPattern Parameters
Pattern As Style
Description Sets the hatching of all Polygons in the set. For . Pattern corresponds to a number indicating a specific polygon pattern. (See Polygon : styleId).. Example
Dim SelectedObjects As Selection Dim NewStyle As Style With NewStyle .Symbol = True .Group = "Test" .Item = "Horizontal" End With SelectedObjects.PolygonPattern = NewStyle
PolygonBorder Parameters
Border As Integer
Description Sets the border of all polygons in the set, to Border. Border = ptNoBorder: The polygons will be filled normal (not only a border). Border = ptBorder1mm .. ptBorder10mm: The width of the border of the polygons will be from 1 mm up to 10 mm depending on the value of the parameter. Border = ptBorder1mmOpen .. ptBorder10mmOpen : The width of the border of the polygons will be from 1 mm up to 10 mm depending on the value of the parameter. The last leg of the polygon is left open. Example
Dim A As Application Dim Doc As Document Dim SelectedObjects As Selection Set A = New Application A.GetActiveDocument Doc
Page 36-11
PolygonOpaque Parameters
Opaque As Boolean
Description Sets the attribute Opaque of all Polygons in the set. If Opaque = True, then the polygons will be opaque. Example
SelectedObjects.PolygonOpaque = True
PolygonBackgroundColor Parameters
BGColor As Integer
Description Sets the background color of all Polygons in the set. BGColor corresponds to a color number of the systems color palette. Setting the background color has only effect if the type of background is set. Example
SelectedObjects.PolygonBackgroundPattern = ptGray50 SelectedObjects.PolygonBackgroundColor = 81
PolygonBackgroundPattern Parameters
BGPattern As Integer
Description Sets the background pattern of all Polygons in the set. BGPattern corresponds to a number indicating a specific polygon pattern. (See Polygon : styleId). Only the values ptNoFill, ptSolidFill, ptGrayxx (xx = 75, 50, 25 or 12) are valid background patterns. Example
SelectedObjects.PolygonBackgroundPattern = ptSolidFill
CanChangeOverlay Returns
CanChange As Boolean
Description Returns TRUE if all objects in the set can be moved from paper overlay to drawing overlay or vice versa. It is not always possible to change the overlay of an object. A line refers to 2 points. The line can only be moved to another overlay together with the 2 points. Example
Dim Dim Dim Dim A As Application Doc As Document MyDrawing As AllObjects DrawingOverlay As Overlay
Set A = New Application A.GetActiveDocument Doc Doc.GetOverlay ptDrawing, DrawingOverlay DrawingOverlay.GetAllObjects MyDrawing If MyDrawing.CanChangeOverlay Then MyDrawing.ChangeOverlay ' Will move objects to Paper overlay End If
Container Returns
Compound
Page 36-12
Description All members of the set will become a member of the Compound. Assigning to Nothing will exclude the CadObjects from the compound they belonged to. All objects in a Container must be in the same Overlay and in the same Subdocument. If objects are in the overlay ptPaper, the objects must be in the same Sheet. Container property is only applicable to Selected and Flagged objects. Example
Dim Dim Dim Dim A As Application Doc As Document Flagged As FlaggedObjects C As Compound
Set A = New Application A.GetActiveDocument Doc Doc.GetFlaggedObjects Flagged Set Flagged.Container = C ' All flagged objects will become member of compound.
Methods
Count Returns
Number As Long Types As Long
Parameters
Description Returns the number of CadObjects in the set whose type is in Types. Types : is the sum of the combination of any of the following constants : ptPoint, ptLine, ptArc, ptClothoid, ptText, ptRichText, ptImage, ptCurve, ptPath, ptPolygon, ptCircle, ptCoordinateSystem, ptCompound . If you need to count all object types, the constant ptAll should be used. Example
Dim Dim Dim Dim Dim Dim Dim Dim A As Application Doc As Document DrawingOverlay As Overlay Object As CadObject MyDrawing As AllObjects Number As Long, Counter As Long Cnt As Long P As Point
Set A = New Application A.GetActiveDocument Doc Doc.GetOverlay ptDrawing, DrawingOverlay DrawingOverlay.GetAllObjects MyDrawing Number = MyDrawing.Count(ptPoint) Cnt = 0 MyDrawing.GetFirst ptPoint, Object For Counter = 1 TO Number If Object Is Nothing Then ' No more objects Else Object.GetPoint P Cnt = Cnt + 1 End If MyDrawing.GetNext Object Next Counter MsgBox "Nr of points = " & Str(Cnt)
Page 36-13
GetFirst Parameters
Types As Long, Object As CadObject, Optional OnlyWholeObjects As Boolean
Description Returns the first CadObject in the set whose type is in Types. Types : is the sum of the combination of any of the following constants : ptPoint, ptLine, ptArc, ptClothoid, ptText, ptRichText, ptImage, ptCurve, ptPath, ptPolygon, ptCircle, ptCoordinateSystem, ptCompound .The value ptAll is the sum of all object types. OnlyWholeObjects: if False (default value), the first object, and with GetNext the following object in Types is returned. If True, only elementary objects (not being a member of a compound) and compounds, if they are in the set, are returned. The program should check if Object <> Nothing. Example
Dim Dim Dim Dim A As Application Doc As Document Object As CadObject SelectedObjects As Selection
Set A = New Application A.GetActiveDocument Doc Doc.GetSelection SelectedObjects SelectedObjects.GetFirst ptLine + ptArc + ptCircle, Object ' The returned Object is either a Line, Arc or Circle. If Object Is Nothing Then MsgBox "No Line, Arc or Circle Selected" End If SelectedObjects.GetFirst ptAll, Object, True ' Returns either an elementary element of a compound
GetNext Parameters
Object As CadObject
Description GetNext must be called after GetFirst. GetNext returns the next CadObject in the set, whose type is in the types specified by GetFirst. This method will normally be called in a loop until all objects are investigated or until the desired result is reached. When running through the selected objects, including new objects is not allowed. Correct working of the GetNext loop is not guaranteed in that case. Resetting selections is allowed, and this operation will directly change the Selection set. The same restriction applies to flagged objects. The program should check if Object <> Nothing when returning from GetNext. No error is raised if GetNext is called after retrieving the last object from the set. Example See example Count ChangeOverlay Parameters
None
Description Changes the overlay of all objects of the set. If the objects are in the Paper overlay, they will be moved to the drawing overlay. If they are in the drawing overlay, they will be moved to the Paper overlay. The operation will not be done when the overlay of one or more of the objects cannot be changed. If the document contains multiple sheets, the method will only affect the active sheet. See also CanChangeOverlay. When this method is applied to Selection or FlaggedObjects then the corresponding set becomes empty after the operation.
Page 36-14
Example
See CanChangeOverlay.
Copy Parameters
PythagorasClipboard As Boolean
Description Copies all objects of the set to either the Pythagoras clipboard or the system (Mac or Windows) clipboard. When PythagorasClipboard = TRUE then the objects will be copied the Pythagoras clipboard. Example
Dim Dim Dim Dim A As Application Doc As Document Object As CadObject SelectedObjects As Selection
Set A = New Application A.GetActiveDocument Doc Doc.GetSelection SelectedObjects SelectedObjects.Copy False ' Will copy all selected objects to the system ' clipboard
Cut Parameters
None
Description All objects of the set are deleted from the document and copied to the Pythagoras clipboard. Example
Dim Dim Dim Dim A As Application Doc As Document Object As CadObject SelectedObjects As Selection
Clear Parameters
None
Description All objects of the set are deleted from the document. Example
Dim SelectedObjects As Selection SelectedObjects.Clear
Move Parameters
Delta As XYZ
Description Moves all objects of the set using the vector Delta. Care must be taken if some objects refer to other which are not in the set, or objects outside the set refer to objects in the set. The method CanChangeOverlay could be used to check if such references exist. Example
Dim A As Application Dim Doc As Document Dim Object As CadObject Page 36-15
Dim SelectedObjects As Selection Dim Vector As XYZ Set A = New Application A.GetActiveDocument Doc Doc.GetSelection SelectedObjects Vector.x = 10.0 Vector.y = 20.0 Vector.z = 1.0 SelectedObjects.Move Vector
Rotate Parameters
Center As XY, Angle As Double
Description Rotates all objects of the set around point Center. The Angle is counter clockwise in radians. After the operation all rotated objects occur to be in the active subdocument. That is why this method should not be applied to sets containing objects lying outside the active subdocument. Example
Dim Dim Dim Dim Dim A As Application Doc As Document Object As CadObject SelectedObjects As Selection Center As XY
Set A = New Application A.GetActiveDocument Doc Doc.GetSelection SelectedObjects Center.x = 10.0 Center.y = 20.0 SelectedObjects.Rotate Center, 3.1418
Group Parameters
Optional NewCompound As Compound
Description Makes a new Compound containing all objects of the set. If the set contains Cad objects of multiple subdocuments, one compound will be made per subdocument. if the set contains Cad Objects of multiple subdocuments then NewCompound Is Nothing. If this method is applied on AllObjects in overlay ptPaper, then AllObjects should refer to one specific Sheet. Example
Dim Dim Dim Dim Dim A As Application Doc As Document Object As CadObject SelectedObjects As Selection C As Compound
Set A = New Application A.GetActiveDocument Doc Doc.GetSelection SelectedObjects SelectedObjects.Group ' or SelectedObjects.Group C ' Is Nothing if multiple subdocuments
Ungroup Parameters
None
Page 36-16
Description Removes all objects of the set from the Compound they belong to. So the objects of the set will not belong to any Compound after this operation. Example
Dim Dim Dim Dim A As Application Doc As Document Object As CadObject SelectedObjects As Selection
Unpack Parameters
None
DeleteData Parameters
None
AddAnnotation Parameters
MyUnits As Units, AnnotationType As Integer
Description Will add an annotation of type AnnotationType, the units and other parameters regarding the annotation are given by MyUnits. (See Object Class Units) Example
Dim Dim Dim Dim Dim A As Application Doc As Document Object As CadObject SelectedObjects As Selection MyUnits As Units
Page 36-17
Set A = New Application Set MyUnits = New Units MyUnits.DecimalPlacesForLengths = 2 A.GetActiveDocument Doc Doc.GetSelection SelectedObjects SelectedObjects.AddAnnotation MyUnits, ptAn_LineLength
AdjustDisplayLevel Parameters
Delta As Integer
Description Adjusts the display level of all objects in the set with the value given by parameter Delta. When the adjusted display level would exceed the limiting value of a display level (-10 .. +10), then an error will be raised. The value of Delta must be between -10 and +10. Example
Dim A As Application Dim Doc As Document Dim SelectedObjects As Selection Set A = New Application A.GetActiveDocument Doc Doc.GetSelection SelectedObjects SelectedObjects.AdjustDisplayLevel -3
SetZ Parameters
Height As Double
Description Sets the Z value of the objects in the set to the specified value. Example
Dim SelectedObjects As Selection SelectedObjects.SetZ 34.7
ScalePoints Parameters
AbsoluteScale As Boolean, ScaleX As Double, ScaleY As Double
Description Changes the scale all the symbols in the set. If the parameter AbsoluteScale = True, then ScaleX and ScaleY denote the scale to which the symbols will be set. If AbsoluteScale = False, then ScaleX and ScaleY will be applied to the current scale factor. The scale factors are expressed in %. So a value of 200 means that the symbols will be scaled with a factor 2. Attention : in the case of AbsoluteScale = True and a scale factor is positive, the sign of the corresponding previous scale of each point in the set will be retained. If the scale factor is negative, the sign of the corresponding previous scale of each point in the set will be inverted. Example
SelectedObjects.ScalePoints False, 50.0, 100.0
ScaleLines Parameters
AbsoluteScale As Boolean, ScaleFactor As Double
Description Changes the scale of all the lines in the set. If the parameter AbsoluteScale = True, then ScaleFactor denotes the scale to which the style of the lines will be set. If AbsoluteScale = False, then ScaleFactor will be applied to the current scale factor. It is obvious that only lines with a scalable line style will be affected. The scale factor is expressed in %.
Page 36-18
Attention : in the case of AbsoluteScale = True and the scale factor is positive, the sign of the previous scale of each line in the set will be retained. If the scale factor is negative, the sign of the previous scale of each line in the set will be inverted. Example
SelectedObjects.ScaleLines True, 50.0
ScaleTexts Parameters
ScaleFactor As Double
Description Scales the texts in the set by a given scale factor. Since the size of texts are discrete values between 1 and 1000. The result will be rounded to the nearest cardinal value. Example
SelectedObjects.ScaleTexts 200.0 ' Point size X 2
ScalePolygons Parameters
AbsoluteScale As Boolean, ScaleFactor As Double
Description Changes the scale of all the polygons in the set. If the parameter AbsoluteScale = True, then ScaleFactor denotes the scale to which the style of the hatching will be set. If AbsoluteScale = False, then ScaleFactor will be applied to the current scale factor. It is obvious that only polygons with a scalable hatching will be affected. The scale factor is expressed in %. Example
SelectedObjects.ScalePolygons False, 150.0
AlignPolygons Parameters
Horizontal As Boolean, Origin As XY, Angle As Double
Description Aligns the hatching of all polygons in the set. If Horizontal = True, then the hatchings will become horizontal to the page and have an absolute origin which is the same for all unaligned hatchings. In this case, the other parameters are ignored. If Horizontal = False, then the origin of the hatchings is defined by the parameter Origin, and the angle by the parameter Angle. Example
Const pi = 3.1416 Dim Org As XY Org.X = 10.0 Org.Y = 10.0 SelectedObjects.AlignPolygons False, Org, 45.0/180.0*pi
ConvertObjectsToPolylines Parameters
Types As ObjectTypes
Description Converts all lines of the set to polylines. The original lines are deleted. Types must be equal to ptLine. Example
SelectedObjects.ConvertObjectsToPolylines ptLine
GetFirstPoint Parameters
Center As XY, Radius As Double, Points As Point
Page 36-19
Description Returns the first point that lies within the circle with the given center and radius. The first point is not necessarily the point that is nearest to the center. Points are returned in random order. Example
See GetNextPoint
GetNextPoint Parameters
Point As Point
Set A = New Application A.GetActiveDocument Doc Doc.GetFlaggedObjects Flagged Center.x = 10.0 Center.y = 10.0 Flagged.GetFirstPoint Center, 1.5, Pnt If Pnt Is Nothing Then MsgBox "No Point found" End If Do While Pnt <> Nothing Flagged.GetNextPoint Pnt Loop
IntersectingLines Parameters
IntersectType As Long, NrOfLines As Long, Lines() As LinePair, Optional OnlyVisibleLayers As Boolean = False
Description Makes a list of the lines, arcs and curves (curvature = 0) that one or other way intersect. Overshoot conditions are not taken into account. IntersectType : only line pairs that satisfy the condition will be returned. ptPartiallyOverlapping: if 2 lines partially overlap, ptIdenticalLines: if 2 lines are completely identical, ptIntersectingLines: if 2 lines intersect. Parallel lines and lines with a common end point are excluded. ptCommonEndPoint: if 2 lines have a common end point. Does not include partially overlapping lines that have a common end point. On return : NrOfLines : the number of line pairs in the array Lines Lines : all the line pairs that intersect. Maximum 100 line pairs are returned. Indexing starts from 1. Example
Dim Dim Dim Dim Dim A As Application Doc As Document Lines() As LinePair NrOfLines As Long Flagged As FlaggedObjects
Set A = New Application A.GetActiveDocument Doc Doc.GetFlaggedObjects Flagged Flagged.IntersectingLines ptIntersectingLines, NrOfLines, Lines, _ OnlyVisibleLayers:=True
Page 36-20
Intersections Parameters
MaxDs As Double, NrOfLines As Long, Lines() As LinePair, Optional OnlyVisibleLayers As Boolean = False
Description Makes a list of objects (line, arc, curve or polygon) that intersect with each other. Overshooting objects, (overshoot condition is defined by parameter MaxDS), will not be included in the list. MaxDs : value defining the the overshoot condition. On return : NrOfLines : the number of line pairs in the array Lines Lines : all the line pairs (lines and arcs) that have the undershoot error. Example
Dim Dim Dim Dim A As Application Lines() As LinePair NrOfLines As Long Flagged As FlaggedObjects
Set A = New Application A.GetActiveDocument Doc Doc.GetFlaggedObjects Flagged Flagged.Intersections 0.05, NrOfLines, Lines, OnlyVisibleLayers=True
UnderShoot Parameters
MinDs As Double, MaxDs As Double, NrOfLines As Long, Lines() As LinePair Optional OnlyVisibleLayers As Boolean = False
Description Makes a list of lines that have undershoot error. MinDs and MaxDs : values defining the the overshoot conditions. On return : NrOfLines : the number of line pairs in the array Lines Lines : all the line pairs (lines and arcs) that have the undershoot error. Example
Dim Dim Dim Dim A As Application Lines() As LinePair NrOfLines As Long Flagged As FlaggedObjects
Set A = New Application A.GetActiveDocument Doc Doc.GetFlaggedObjects Flagged Flagged.Undershoot 0.01, 0.05, NrOfLines, Lines, OnlyVisibleLayers:=True
OverShoot Parameters
MinDs As Double, MaxDs As Double, NrOfLines As Long, Lines() As LinePair Optional OnlyVisibleLayers As Boolean = False
Page 36-21
SetTextFont Parameters
FontName As String, CodePage As Integer
Transform Parameters
Transformation As HelmertTransformation, SmoothResiduals As Boolean, OptionalSmoothOutType As Integer = ptAllDistances
Description Transforms all objects of the set. The parameter Transformation must have been calculated using the HelmertTranformation method Calculate. If the boolean SmoothOutResiduals = True, then the pass points which were used to calculate the transformation, will be moved so that the coordinates will be excactly the same as the target coordinates. In that case, the drawing (only the elements of the set) will be distorted. SmoothOutType:used to define the type of interpolation. ptNNDistance: only the residuals of the Natural Neighbours are used. The interpolation is based on the distance (1/s) to the Natural Neighbours (subset of the Tie Points). ptNNArea: only the residuals of the Natural Neighbours are used. The interpolation is based on a method where the change of area in the Voronoi Tessellation defines the weight. ptAllDistances: the residuals of all Tie Points are taken into account. The weight is inverse proportional with the square of the distance to the Tie Points. (1/s) ptInTrianglePlane: the residuals of the 3 points of the triangle in the delauney triangulation is used to calculate the weight. See also object HelmertTransformation. Example
Dim SelectedObjects As Selection Dim Tr As HelmertTransformation SelectedObjects.Transform Tr, True, ptNNArea
ClearSet Parameters
None
Description Makes the set empty. This method can not be applied to AllObjects. Example
Dim A As Application Dim Doc As Document Dim Flagged As FlaggedObjects Set A = New Application A.GetActiveDocument Doc Doc.GetFlaggedObjects Flagged Flagged.ClearSet
MakeSet Parameters
OverlayType As Integer, SelCriteria As SelectionCriteria, Optional Table As DBTable = Nothing
Page 36-22
Description Initializes a set containing objects in the overlay OverlayType (either ptDrawing or ptPaper). The parameter SelCriteria defines which objects will be included in the set. Only objects of visible layers will be included. If Table <>Nothing then only objects that are linked to the given table are included in the set. This method can not be applied to AllObjects. SelectionCriteria should be initialised with the Application method InitSelectionCriteria. Example
Dim Dim Dim Dim A As Application Doc As Document Flagged As FlaggedObjects SelCriteria As SelectionCriteria
Set A = New Application A.GetActiveDocument Doc Doc.GetFlaggedObjects Flagged Flagged.ClearSet A.InitSelectionCriteria SelCriteria Inits all fields to default values. With SelCriteria .SelectionType = ptNewSelection .OnColor = True .Color = ptRed .Wallpaper = False .OnSubdocument = False End With Flagged.MakeSet ptDrawing, SelCriteria ' Will put all red objects that are linked to table "Countries" ' in the set Flagged.Cut ' Delete & put on Pythagoras clipboard.
MakeSetDB Parameters
OverlayType As Integer, Criteria As SelectionCriteria, Table As DBTable, DBCriteria() As SelectCondition
Description This method is an extention of MakeSet. The parameter DBCriteria defines additional conditions for the data linked with a CadObject. The array DBCritereria cannot be empty since an array in VBA must contain at least one element. OverlayType value must be ptLocal always otherwise an empty set will be made. All conditions must be valid. If not an error is generated. SelectionCriteria can be initialised with the Application method InitSelectionCriteria. DBCriteria : for more information see the Pythagoras Data Type SelectCondition. Example
Dim Dim Dim Dim Dim Dim A As Application Doc As Document Flagged As FlaggedObjects SelCriteria As SelectionCriteria DBCriteria() As SelectCondition Countries As DBTable
Set A = New Application A.GetActiveDocument Doc Doc.GetFlaggedObjects Flagged Flagged.ClearSet A.InitSelectionCriteria SelCriteria Inits all fields to default values. SelCriteria.SelectionType = ptNewSelection SelCriteria.Objects = ptPolygon Redim DBCriteria(0)
Page 36-23
DBCriteria(0) = A.SelectCondition("Population", ptCompareGreaterEqual, 10000000) Flagged.MakeSetDB ptDrawing, SelCriteria, Countries, DBCriteria ' Polgygons linked to table Countries with Population >= 10 million.
MakeSetTextual Parameters
OverlayType As Integer, Criterion As String, Optional SelectionType As Integer = ptNewSelection, Optional Table As DBTable = Nothing,
Description This method is a variant of MakeSet, where the selection criteria are defined in textual form. Criterion: a string that must describe a Boolean expression. Eg. "NrChildren > 2". See also Application method Parse. Table: if Not Table = Nothing, then the expression may contain field names of the given table. Note: to avoid errors in the syntax, it may be usefull to call the Application method Parse to check validity of the parameter Criterion. Example
Dim Dim Dim Dim A As Application Doc As Document Flagged As FlaggedObjects Families As DBTable
Set A = New Application A.GetActiveDocument Doc Doc.GetFlaggedObjects Flagged Flagged.ClearSet Flagged.MakeSetTextual ptDrawing, "NrChildren > 2", ptNewSelection, Families
Toggle Parameters
Obj As CADObject
Description If Obj is in the set, it is removed from the set. If Obj is not in the set, Obj is added to the set. This method can not be applied to AllObjects. Example
Dim Dim Dim Dim A As Application Doc As Document Obj As CADObject Flagged As FlaggedObjects
Set A = New Application A.GetActiveDocument Doc Doc.GetFlaggedObjects Flagged Flagged.ClearSet Flagged.Toggle Obj
Include Parameters
Obj As CADObject
Description If Obj is not in the set, it is included. This method can not be applied to AllObjects. Example
Dim Dim Dim Dim A As Application Doc As Document Obj As CADObject Flagged As FlaggedObjects
Page 36-24
Exclude Parameters
Obj As CADObject
Description If Obj is in the set, it is excluded from the set. This method can not be applied to AllObjects. Example
Dim Dim Dim Dim A As Application Doc As Document Obj As CADObject Sel As Selection
Set A = New Application A.GetActiveDocument Doc Doc.GetSelection Sel If Sel.InSet(Obj) Then Obj.Comment = "ABC" Sel.Exclude Obj End If
InSet Parameters
Obj As CADObject
Description Returns True if Obj is in the set. This method may not be applied to AllObjects. Example
See Exclude
ApplyThematics Parameters
Attribs as AttributesSet
Description Applies a thematic representation defined by AttributesSet to all the objects in the set. This method cannot be applied neither to Selection nor to AllObjects limited to a sheet. Calling this method for AllObjects removes a thematic defined for the same overlay even if it was defined for a set with different value of Wallpaper. Example
Dim Dim Dim Dim Dim A As Application Doc As Document Ovl as Overlay All As AllObjects Attribs as AttributesSet
Set A = New Application A.GetActiveDocument Doc Doc.GetOverlay ptDrawing, Ovl Ovl.GetAllObjects All Set Attribs = New AttributesSet All.ApplyThematics Attribs
Page 36-25
GetThematics Parameters
Attribs as AttributesSet
Description Returns the thematic representation that has been applied using ApplyThematics. This method cannot be applied neither to Selection nor to AllObjects limited to a sheet. Example
Dim Dim Dim Dim Dim A As Application Doc As Document Ovl as Overlay All As AllObjects Attribs as AttributesSet
Set A = New Application A.GetActiveDocument Doc Doc.GetOverlay ptDrawing, Ovl Ovl.GetAllObjects All All.GetThematics Attribs
RemoveThematics Description Removes the thematic representation that has been applied to the set. This method cannot be applied neither to Selection nor to AllObjects limited to a sheet. Example
Dim Dim Dim Dim Dim A As Application Doc As Document Ovl as Overlay All As AllObjects Attribs as AttributesSet
Set A = New Application A.GetActiveDocument Doc Doc.GetOverlay ptDrawing, Ovl Ovl.GetAllObjects All All.RemoveThematics
ExportShape Parameters
Optional Optional Optional Optional Optional Optional Path As String := "" AskAttribures As Boolean ExportType As Integer := ExportObjInfo As Boolean ExportInvisiblePoints as PrefixType as Integer :=
Description This method exports all objects in the set to a shape file. Pathneeds to be an existing path, if Path = "",a requestfolder dialog will be opened. AskAttributes: if = True, a dialog box comes up requesting export parameters. The parameters passed by VBA become the defaults in the dialog. ExportType defines how you want to export coordinates. Possible values: ptShape2D, ptShape2DM, ptShape3D. Export is done in current CRS and in meters. Objects of the page overlay are not exported even when they have the corresponding flag set. When this method is applied to AllObjects then all objects of the local overlay are exported independently of how the set is defined: for which overlay and sheet and with which value of Wallpaper parameter.
Page 36-26
Example
Set A = New Application A.GetActiveDocument D If Not (D is Nothing) Then D.GetOverlay ptDrawing, O O.GetAllObjects All All.ExportShape AskAttributes:=TRUE, ExportType:=ptShape2DM,_ ExportInvisiblePoints:=TRUE End If
GetTerrainModel Parameters
Name As String, ReduceParams As DTMReduce, TM As TerrainModel
Description Creates a terrain model with specified Name based on the object set. ReduceParams indicate if and how reduction should be applied. Only points, lines and polygons are considered with the following restrictions: If more than one polygon is in the set then all polygons are ignored; If exactly one polygon is in the set it will be the boundary of the terrain model; If no polygon is selected there should be points in the set to make up the terrain model; If there are lines, arcs, circles or clothoids in the object set they will be used as breaklines. Example
Dim A As Application Dim Doc As Document Dim SelectedObjects As Selection Dim Red As DTMReduce TM As TerrainModel Set A = New Application A.GetActiveDocument Doc Doc.GetSelection SelectedObjects Red.Reduce = False SelectedObjects.GetTerrainModel SampleTerrainModel, Red, TM
Page 36-27
Chapter 37 - TerrainModel
Description The TerrainModel object corresponds with an existing Digital Terrain Model in a Pythagoras drawing. This object can not be created, but a reference to an existing Digital Terrain Model can be obtained from the set of terrain models. See also the object type TerrainModels. Example
Dim Dim Dim Dim Dim Dim A As Application Doc As Document DTMs As TerrainModels DTM1 As TerrainModel Height As Double Pos As XY
Set A = New Application A.GetActiveDocument Doc If NOT Doc is nothing Then Doc.GetTerrainModels DTMs If DTMs.NrOfTerrainModels > 0 Then DTMs.FindTerrainModel "Existing Situation", DTM1 If DTM1 Is Nothing Then MsgBox "DTM : 'Existing Situation' does not exist." Else Pos.x = 30.0 Pos.y = 20.0 Height = DTM1.Elevation(Pos) If Height = ptNilElevation Then MsgBox "Point outside DTM" Else MsgBox "Height at 30.0, 20.0 = " & CSTR(Height) End If End If End If end if
Properties
Name zMin zMax NrOfTriangles NrOfVertexes EnclosingRectangle Elevation AdjustElevationOfVertext AdjustAllElevations Slope GetTriangle GetFirstTriangle GetNextTriangle GetFirstVertex GetNextVertex CrossSection CrossSectionPnts Duplicate AddVertex RemoveVertex MoveVertex AddTriangle RemoveTriangle SwapDiagonal
Methods
TerrainModel
Page 37-1
Properties
Name Returns
String
zMin Value
Double
Description Returns the height of the lowest point of the DTM. Example
Dim MinHeight As Double, MaxHeight As Double Dim DTM As TerrainModel MinHeight = DTM.zMin MaxHeight = DTM.zMax
zMax Value
Double
Description Returns the height of the highest point of the DTM. Example
Dim MinHeight As Double, MaxHeight As Double Dim DTM As TerrainModel MinHeight = DTM.zMin MaxHeight = DTM.zMax
NrOfTriangles Value
Long
NrOfVertexes Value
Long
TerrainModel
Page 37-2
Count = DTM.NrOfVertexes
EnclosingRectangle Value
Rectangle
Methods
Elevation Parameters
Position As XY
Description Returns the height at Position in the DTM. If the point lies outside the DTM, then ptNilElevation is returned. Example
Dim Height As Double Dim Pos As XY Dim DTM1 As TerrainModel Pos.x = 30.0 Pos.y = 20.0 Height = DTM1.Elevation(Pos) If Height <> ptNilElevation Then 'Do Something End If
AdjustElevationOfVertex Parameters
Vertex As XY
Description This method adjusts the elevation of the Vertex at the specified position. If the position does not match with a vertex, nothing is happening. Example
Dim V As XY Dim DTM1 As TerrainModel V.x = 30.0 V.y = 20.0 DTM1.AdjustElevationOfVertex V, 12.34567
AdjustAllElevations Parameters
dZ As Double
Description This method adjusts the elevation of all vertexes in the DTM with a height difference equal to dZ. Example
Dim DTM1 As TerrainModel DTM1.AdjustAllElevations 1.7
TerrainModel
Page 37-3
Slope Parameters
Position As XY, Gradient As Double, Direction As Double
Description Returns the gradient and the downward direction of the slope at Position in the DTM. If the point lies outside the DTM, then both values will be = 0. The gradient is tangent of the angle of the slope (dS/dZ). Example
Dim Pos As XY Dim DTM As TerrainModel Dim Gradient As Double, Direction As Double Pos.x = 30.0 Pos.y = 20.0 DTM.Slope Pos, Gradient, Direction
GetTriangle Parameters
Pos As XY, T As Triangle
Description Returns the triangle of a TerrainModel. The projection of the point with coordinates (x, y) will be inside, or on the edge, of the triangle. If Pos is outside the Digital Terrain Model, Nothing is returned Example
Dim Dim Dim Dim x As Double, y As Double Pos As XY DTM As TerrainModel T As Triangle
GetFirstTriangle Parameters
T As Triangle
Description Returns the first triangle of a TerrainModel. GetFirstTriangle must be called before calling GetNextTriangle. Example
Dim DTM As TerrainModel Dim P1 As XYZ, P2 As XYZ, P3 As XYZ Dim T As Triangle DTM.GetFirstTriangle T Do While Not(T Is Nothing) T.Vertexes P1, P2, P3 DTM.GetNextTriangle T Loop
GetNextTriangle Parameters
T As Triangle
Description Returns the next triangle of a TerrainModel. May only be called after call to GetFirstTriangle. Example
See GetFirstTriangle
TerrainModel
Page 37-4
GetFirstVertex Parameters
Vertex As XYZ
Description Returns the first vertex of a TerrainModel. GetFirstVertex must be called before calling GetNextVertex. Example
Dim DTM As TerrainModel Dim V As Vertex DTM.GetFirstVertex V Do While Not(V Is Nothing) MsgBox "(" & V.X & ", " & V.Y & ", " & V.Z & ")" DTM.GetNextVertex V
GetNextVertex Parameters
Vertex As XYZ
Description Returns the next vertex of a TerrainModel. May only be called after call to GetFirstVertex. Example
See GetFirstVertex
CrossSection Parameters
Obj As CadObject, NrOfXSPoints As Long, XS_Points() As XY
Description Returns the cross section through the DTM at the positions defined by the CadObject Obj. Obj is either a Line, an Arc, a Clothoid, a Path, a Road or a Polygon. When the object is a line or an arc, the starting point corresponds with the first point of the line or arc. On return XS_Points contains the station (chainage) and the height of all points of intersection of the object with the DTM in increasing order. The parameter NrOfXSPoints contains the number of points in the dynamic array XS_Points. Points of the cross section that are outside the DTM have the elevation ptNilElevation. The segment consisting of a pair or cross section points (XS_Points(n), XS_Points(n+1)) where either point n or point n+1 has the elevation ptNilElevation, lies outside the DTM. The array XS_Points should be large enough to contain all points of the cross section. If not, an error is raised. If Obj is a path, the starting chainage of the path is taken into account. Example
Sub PM_GetCrossSection Dim Dim Dim Dim Dim Dim Dim Dim Dim Dim Dim Dim Dim A As Application Doc As Document, Doc2 As Document DTMs As TerrainModels DTM1 As TerrainModel Pth As Path Obj As CadObject NrOfXSPoints As Long XS_Points() As XY SelectedObjects As Selection i As Long DrawingXS As Overlay Pnt As XYZ P As Point
Set A = New Application A.GetActiveDocument Doc If NOT Doc is nothing Then Doc.GetTerrainModels DTMs If DTMs.NrOfTerrainModels > 0 Then
TerrainModel
Page 37-5
DTMs.FindTerrainModel "Existing Situation", DTM1 If DTM1 Is Nothing Then MsgBox "DTM : 'Existing Situation' does not exist." Else Doc.GetSelection SelectedObjects If SelectedObjects.NrOfObjects = 1 Then SelectedObjects.GetFirst ptPath, Obj If Not (Obj Is Nothing) Then Redim XS_Points(1 To 100000) DTM1.CrossSection Obj, NrOfXSPoints, XS_Points A.GetNewDocument Doc2 Doc2.GetOverlay ptDrawing, DrawingXS For i = 1 To NrOfXSPoints Pnt.x = XS_Points(i).x Pnt.y = XS_Points(i).y Pnt.z = 0.0 DrawingXS.CreatePoint Pnt, P Next i End If Else MsgBox "Select a path" End If End If End If end if End Sub
CrossSectionPnts Parameters
NrOfPoints As Long, Points() As XY, NrOfXSPoints As Long, XS_Points() As XY
Description The method CrossSectionPnts is very similar to CrossSection. The only difference is the definition of the position where to calculate the cross section. In stead of passing a CadObject, an array of 2D points defines the position where to calculate the cross section. Returns the cross section through the DTM at the positions defined by the array Points. NrOfPoints is the number of points in this array. On return XS_Points contains the station (chainage) and the height of all points of intersection of the object with the DTM in increasing order. The parameter NrOfXSPoints contains the number of points in the dynamic array XS_Points. Points of the cross section that are outside the DTM have the elevation ptNilElevation. The segment consisting of a pair or cross section points (XS_Points(n), XS_Points(n+1)) where either point n or point n+1 has the elevation ptNilElevation, lies outside the DTM. The array XS_Points should be large enough to contain all points of the cross section. If not, an error is raised. Example
Dim Dim Dim Dim Pnts() As XY NrOfXSPoints As Long XS_Points() As XY DTM As TerrainModel
Duplicate Parameters
Name As String TM As TerrainModel
Description With this method a user can create a duplicate of an existing terrain model. A unique Name should be passed to identify the new terrain model. If a terrain model with the same name already exists in the document an error is generated.
TerrainModel
Page 37-6
Example
AddVertex Parameters
Vertex As XYZ
Description The specified Vertex is added to a TerrainModel. The triangles are recalculated to take this new vertex into account. Example
Dim DTM As TerrainModel Dim V As XYZ V.X = -9.0 V.Y = -2.4 V.Z = 10.5 DTM.AddVertex V
RemoveVertex Parameters
Vertex As XY
Description The specified Vertex is removed from the TerrainModel. When the specified position does not correspond with a vertex, nothing happens. Otherwise the triangles in the DTM are recalculated . Example
Dim DTM As TerrainModel Dim V As XY V.X = -9.0 V.Y = -2.4 DTM.RemoveVertex V
MoveVertex Parameters
Vertex As XY Position As XY
Description The specified Vertex is moved to a new position in a TerrainModel. When the specified original vertex position does not correspond with a vertex, nothing happens. Otherwise the triangles in the DTM are recalculated. The new vertex position should be inside the triangle where the original vertex position was. Example
Dim DTM As TerrainModel Dim V As Vertex, V1 As Vertex V.X = -9.0 V.Y = -2.4 V1.X = -10.0 V1.Y = -1.4 DTM.MoveVertex V, V1
AddTriangle Parameters
P1 As XYZ P2 As XYZ P3 As XYZ
TerrainModel
Page 37-7
T As Triangle
Description The triangle specified with 3 points is added to a TerrainModel. The created triangle is returned. Example
Dim Dim Dim Dim P1 As XYZ P2 As XYZ P3 As XYZ T As Triangle
RemoveTriangle Parameters
T As Triangle
SwapDiagonal Parameters
T1 As Triangle T2 As Triangle
Description The diagonal between the two given triangles is swapped. Both triangles should share an edge to make the operation possible. Example
Dim T1 As Triangle Dim T2 As Triangle DTM.SwapDiagonal T1, T2
TerrainModel
Page 37-8
Chapter 38 - TerrainModels
Description The object TerrainModels refers to the set of all Terrain Models in a Pythagoras drawing. An object of this type refers always to the actual situation. So it will never contain DTM's which are deleted. This object can not be created, but can be obtained with the Document method GetTerrainModels. Example
See object type TerrainModel
Properties Methods
Properties
NrOfTerrainModels Returns
Long
Description Returns the number of the Digital Terrain Models in the document. Example
Dim DTMs As TerrainModels MsgBox "Number of DTM's = " & DTMs.NrOfTerrainModels
Methods
GetFirst Parameters
DTM As TerrainModel
Description Returns the first DTM in the drawing. GetFirst must be called before calling GetNext. Example
Dim DTMs As TerrainModels Dim DTM1 As TerrainModel DTMs.GetFirst DTM1
GetNext Parameters
DTM As TerrainModel
TerrainModels
Page 38-1
Dim i As Long Set A = New Application A.GetActiveDocument Doc If NOT Doc is nothing Then Doc.GetTerrainModels DTMs DTMs.GetFirst DTM For i = 1 To DTMs.NrOfTerrainModels DTMs.GetNext DTM Next i End If
FindTerrainModel Parameters
Name As String, DTM As TerrainModel
Description Returns the DTM with the requested name. If no DTM with this name exists, then DTM = Nothing. Example
Dim DTMs As TerrainModels Dim DTM1 As TerrainModel If DTMs.NrOfTerrainModels >= 1 Then DTMs.FindTerrainModel "Ground Works", DTM1 End If
NewTerrainModel Parameters
Name As String, Reduce As DTMReduce, ShowProgress As Boolean, NrOfPoints As Long, Points As XYZ(), NrBoundaryPoints As Long, BoundaryPoints() As XYZ TerrainModel
Returns
Description Creates a terrain model with the requested parameters: Name indicates the name of the new DTM. Reduce specifies if and how reduction should be applied during the calculation. If ShowProgress is true progress bar will be shown during the calculation. NrOfPoints and Points define the 3D points that are used. This list should hold at least three different positions. NrOfBoundaryPoints and BoundaryPoints gives you the possibility to use a boundary to for the calculation. Only points that are contained in this boundary polygon will be used. When this list is empty all positions in Points will be used in the calculation. TBD: Possibility to use break lines. Note: Indexes of the lists are starting from zero. Example
Dim DTMs As TerrainModels Dim ps() As XYZ Dim bs() As XYZ Dim Red As DTMReduce TM As TerrainModel Set tm = DTMs.NewTerrainModel("NewDTM", 3, ps, 4, bs, Red, False)
DeleteTerrainModel Parameters
DTM As TerrainModel Page 38-2
TerrainModels
SetActive Parameters
DTM As TerrainModel
GetActive Parameters
DTM As TerrainModel
TerrainModels
Page 38-3
Chapter 39 - Triangle
Description The Triangle object corresponds with an existing triangle of a Digital Terrain Model in a Pythagoras drawing. This object can not be created, but a reference to an existing Triangle can be obtained from a TerrainModel with the methods GetFirstTriangle, GetNextTriangle or GetTriangle. Example
Dim Dim Dim Dim Dim Dim Dim A As Application Doc As Document DTMs As TerrainModels DTM1 As TerrainModel T As Triangle Pos As XY Height As Double
Set A = New Application A.GetActiveDocument Doc If Not Doc Is Nothing Then Doc.GetTerrainModels DTMs If DTMs.NrOfTerrainModels > 0 Then DTMs.FindTerrainModel "Existing Situation", DTM1 If DTM1 Is Nothing Then MsgBox "DTM : 'Existing Situation' does not exist." Else Pos.x = 30.0 Pos.y = 20.0 DTM1.GetTriangle Pos, T If T Is Nothing Then MsgBox "Point (30.0, 20.0) is outside DTM" Else MsgBox "Point (30.0, 20.0) is inside DTM" End If End If End If End If
Methods
Adjacent Vertexes
Methods
Adjacent Parameters
T1 As Triangle, T2 As Triangle, T3 As Triangle
Description Returns the adjacent triangles. The adjacent triangles are enumerated in counterclockwise order and in correspondence with triangle's vertexes (see Vertexes). T1 is adjacent to the edge P1-P2, T2 is adjacent to the edge P2-P3, and T3 is adjacent to the edge P3-P1. Example
Dim T As Triangle, T1 As Triangle, T2 As Triangle, T3 As Triangle Dim P1 As XYZ, P2 As XYZ, P3 As XYZ T.Adjacent T1, T2, T3 T3.Vertexes P1, P2, P3
Vertexes Parameters
P1 As XYZ, P2 As XYZ, P3 As XYZ
Triangle
Page 39-1
Description Returns the vertexes of a triangle. The vertexes are enumerated in counterclockwise order and in correspondence with the adjacent triangles (see Adjacent). Example
Dim T As Triangle, T1 As Triangle, T2 As Triangle, T3 As Triangle Dim P1 As XYZ, P2 As XYZ, P3 As XYZ T.Adjacent T1, T2, T3 T3.Vertexes P1, P2, P3
Triangle
Page 39-2
Chapter 40 - Database
Description An object of this class describes a database, being ether a document database or a so-called Pythagoras database. Pythagoras databases are databases existing out of Pythagoras documents. They are created by VBA Set New statement. Example
Dim D As Database Set D = New Database ' Do somethig with created database D.CloseDatabase Document LockedDatabase DifferentDatabaseLocks NrOfTables NrOfAttributeTables NrOfDictionaryTables NrOfDBViews FirstTable NextTable TableByName CreateTable ImportDBF DropTable CopyTableSkeleton CopyTable FirstDBView NextDBView DBViewByName CreateSimpleQuery CreateAggregationQuery DropQuery CopyQuery CopyDatabaseSkeleton CopyDatabase PurgeDatabase DropDatabase CloseDatabase NewState EndState LockDatabase UnLockDatabase ActualizeQueries
Properties
Methods
Properties
Document Returns
Document
Description This property returns the document the database belongs to. If the database belongs to no document Nothing is returned. Example
Dim D As Database If D.Document Is Nothing Then ' If this database is not a document one ' Do something
Database
Page 40-1
End If
LockedDatabase Returns
Boolean
DifferentDatabaseLocks Returns
Boolean
Description Returns true if the database belongs to a document and the document contains subdocuments and the locking status (Locked/Unlocked) or, owner name and/or password, of the databases in the main document / subdocuments is not the same. If main document and subdocuments have different locking, the database always remains locked. See also Subdocument method DifferentDatabaseLock. Being applied to Pythagoras databases this property always returns False. Example
Dim D As Database If D.DifferentDatabaseLocks then MsgBox "Not all subdocuments are locked in the same way" End If
NrOfTables Returns
Integer
NrOfAttributeTables Returns
Integer
Description Returns the number of attribute tables in the database. Being applied to Pythagoras database this property always returns 0. Example
Dim D As Database Dim NrTables As Integer NrTables = D.NrOfAttributeTables
Database
Page 40-2
NrOfDictionaryTables Returns
Integer
Description Returns the number of dictionary tables in the database. Being applied to Pythagoras database this property is the same as NrOfTables. Example
Dim D As Database Dim NrTables As Integer NrTables = D.NrOfDictionaryTables
NrOfDBViews Returns
Integer
Methods
FirstTable Parameters None Returns
Table As DBTable
Description FirstTable returns the first table of the database. Returns Nothing if the database contains no table. Example
Dim D As Database Dim T As DBTable Dim S As String S = "List of tables:" Set T = D.FirstTable() While Not T Is Nothing S = S & T.Name & " " Set T = D.NextTable() WEnd
Description NextTable returns the next table of the database. Returns Nothing if the database contains no more tables. Example
See example FirstTable
Database
Page 40-3
Description TableByName returns the table with the given name. Returns Nothing if the database contains no table with such name. Example
Dim D As Database Dim T As DBTable Set T = D.TableByName("Countries")
CreateTable Parameters
TableType As Byte, Name As String, Optional Description As String, Optional ObjectTypes As Long DBTable
Returns
Description CreateTable creates a new table in the database. The table will contain no fields. For document databases access permission is initialized to ptFullAccess. This method will be normally be used to create a table. Subsequently columns need to be added. See DBTable method AddColumn. TableType : either ptDictionary = table not linked to CadObjects, or ptAttrTable (only in document databases) = table linked to CadObjects. Name : the name of the new table. The name must be valid. See also Application property NameCategory. Description : description of the table. By default the string is empty. ObjectTypes : Pythagoras object types that may link to this table. Eg: ptPoint + ptPolygon. Note: a coordinate system can not be linked to a table. This parameter should be omitted or be equal to 0 if Type = ptDictionary. If TableType = ptAttrTable then the parameter must be given and must be different from 0. Example
Dim D As Database Dim T As DBTable Set D = New Database Set T = D.CreateTable (ptDictionary, "Countries")
ImportDBF Parameters
FileName As String, Optional TableName As String = "", Optional CodePage As Long = 0, Optional Completion As PtImportCompletion DBTable
Returns
Description ImportDBF reads a DBF file and lay down read data to a new dictionary table in the database. The new table will be an exact copy of the file, i.e. it will contains the same number of columns with the same names and same data types and it will contain the same number of rows with same data. FileName: a full path to DBF file, name extension may be omitted. TableName : the name of the new table. If it is omitted or is an empty string then pure name of the file will be taken as a name of the new table.
Database
Page 40-4
CodePage defines Window code page used to convert string data to Unicode during import. It should be equal to a code page, string data are in the file in. If CodePage = 0 (default) then the code page indicated inside the file (in so-called code page mark field) is used; if code page mark = 0 or indicates an unsupported encoding then the code page installed as default in Windows (Control PanelRegional and Language OptionsAdvanced) is used If CodePage is positive then code page with this number is used. If the number is illegal then the further algorithm is the same as for CodePage = 0 (see above). Negative CodePage defines a default code page. If the code page mark field defines some supported code page, it is used. Otherwise the code page with number equal to an absolute value of the parameter is used. If the parameter value is also illegal then the default Windows code page is used. Completion is filled by the completion code (see also PtImportCompletion description). String values are right-trimmed during import. Column of type N with decimal digits number = 0 are converted to columns of type vbLong, vbDouble or vbString dependently of actual data being in these columns. In case of success the created database table is returned otherwise Nothing is returned. The current version of the method has the following limitations: type of file: dBase or FoxBase data encryption is not supported types of fields: C, D, F, L, M, and N field flags ignored, binary data is not supported Example
Dim D As Database Dim T As DBTable Set D = New Database Set T = D.ImportDBF ("C:\Data\Population", CodePage:=-1252) If T Is Nothing Then MsgBox ("Import of C:\Data\Population.dbf Failed") End If ' String data from file are converted correspondingly ' to the code page mark value. ' If code page mark = 0 ' then Western Europe Windows encoding is assumed.
DropTable Parameters
Table As DBTable
Description This method removes the table from the database. All data are lost. Example
Dim D As Database Dim T As DBTable D.DropTable T
Description This method creates and returns a new, but empty, table in the current database with the same properties as Table. Table is assumed to belong to another database. If WithReferences = False then columns with attribute ReferencedColumn being not Nothing in the source table will get the attribute ReferencedColumn = Nothing in the new created table.
Database
Page 40-5
If WithReferences = True then for each column with attribute ReferencedColumn <> Nothing an attempt is made to find in the current database a table and its column with the same names as in the source database. If all references are found, then the attributes ReferencedColumn are copied, otherwise an error is raised and the table skeleton is not copied. Example
Dim D1 As Database, D2 As Database Dim T1 As DBTable, T2 As DBTable Set T1 = D1.TableByName("Countries") Set T2 = D2.CopyTableSkeleton(T1, WithReferences:=True)
Description This method creates and returns a new table in the current database with the same properties as Table. Additionally it copies all rows. Table must be a dictionary table. Table is assumed to belong to another database. WithReferences: see CopyTableSkeleton. After copying, the new table may contain pending references, i.e. references to other tables having no matches. These references may be corrected by calling the PurgeDatabase method. Example
Dim A As Application Dim D1 As Database, D2 As Database Dim T1 As DBTable, T2 As DBTable Set T1 = D1.TableByName("Countries") Set T2 = D2.CopyTable(T1, WithReferences:=True)
Description FirstDBView returns the first view of the database. Returns Nothing if the database contains no view. Example
Dim D As Database Dim S As String Dim V As DBQuery S = "List of views:" Set V = D.FirstDBView() While Not V Is Nothing S = S & T.Name & " " Set V = Doc.NextDBView() WEnd
Database
Page 40-6
Description NextDBView returns the next view of the database. Returns Nothing if the database contains no more views. Example
See example FirstDBView
Description DBViewByName returns a view the given name. Returns Nothing if the database contains no such view. Example
Dim D As Database Dim V As DBQuery Set V = D.DBViewByName("PopulationDensity")
CreateSimpleQuery Parameters
Base As RowSetDefinition, Optional Name As String = "", Optional Description As String = "", Optional Where As String = "", Optional Preferences As Units = Nothing, DBQuery
Returns
Description CreateSimpleQuery creates a new simple query in the database. The query will contain no nontextual where conditions and no columns. New query will be either a view or a temporary query; see description of class DBQuery for discussion of DB views and temporary queries. This method will be normally used to create a simple query using VBA. Subsequently non-textual where conditions and columns can be added. See class DBQuery methods AddWhere and AddColumn. Base defines the main base rowset (a table, a set of CAD objects or another query). A temporary query cannot be a base of a view. When defining a new DB view and Base.RowSetType=ptObjectSet, then Base.ObjectTypes should have only a value compatible with one of system tables, i.e. one of the following values: ptAllDBLinkable, ptLine+ptArc+ptCircle+ptCurve+ptPath+ptClothoid+ptRoad , ptPont, ptLine, ptArc, ptCircle, ptClothoid, ptCurve, ptPolygon, ptText+ptRichText, ptRoad, ptPath. Name : the name of the new view. The name must be valid or empty. See also Application property NameCategory. If the name is empty then a temporary query is created otherwise a DB view is created. Description : description of the query. Where : starting value of property Where; see its description. Preferences : Preferences used to calculate query values. By default the current preferences of the session are used. See also class DBQuery property Preferences. Unlike CreateTable method this and next methods almost always create a new query. But depending on query definition and presence in the database of referenced tables or queries the created query can be valid or not. See also class DBQuery property Validity. Example
Dim D As Database Dim RowSet As RowSetDefinition Dim V As DBQuery RowSet.RowSetType = ptTable
Database
Page 40-7
CreateAggregationQuery Parameters
MainBase Match As Optional Optional Optional DBQuery As RowSetDefinition, AuxBase As RowSetDefinition, MatchCondition, Name As String = "", Optional Description As String = "", Where As String = "", Preferences As Units = Nothing
Returns
Description CreateAggregationQuery creates a new database aggregation query in the database. The query will contain no non-textual where conditions and no columns. New query will be either a view or a temporary query; see description of class DBQuery for discussion of DB views and temporary queries. This method will be normally be used to create an aggregation query using VBA. Subsequently non-textual where conditions and columns can be added. See DBQuery methods AddWhere and AddColumn. MainBase and AuxBase define the base rowsets; restrictions on possible values are the same as for Base parameter of CreateSimpleQuery method. Match : a condition defining which pairs of rows of both bases correspond, see class DBQuery property Match. Name, Description, Where and Preferences have the same meanings as described in the previous method. Example
Dim A As Application, D As Database Dim Main As RowSetDefinition, Aux As RowSetDefinition Dim V As DBQuery Main.RowSetType = ptTable Main.Name = "Countries" Aux.RowSetType = ptTable Aux.Name = "Cities" Set V = _ D.CreateAggregationQuery (Main, Aux, _ A.MatchCondition(PtConditionDistance,Distance:=0.0), _ "CountriesWithCities")
DropQuery Parameters
Query As DBQuery
Description This method removes the query from the database. Example
Dim D As Database Dim Q As DBQuery D.DropQuery Q
Description This method creates and returns a new query in this database with the same definition as Query.
Database
Page 40-8
Query as a rule belongs to another database. Note that a DB view cannot be copied to the same database (a name is repeated!). When a temporary query referencing other temporary queries is copied to another database, such references are lost. Example
Dim A As Application Dim Doc1 As Document, Doc2 As Document Dim V1 As DBQuery, V2 As DBQuery Set V1 = Doc1.QueryByName("CountriesWithCities") Set V2 = Doc2.CopyQuery(V1)
CopyDatabaseSkeleton Parameters
Source As Variant, Optional WithViews As Boolean = True
Description CopyDatabaseSkeleton deletes all tables and queries from the database and then creates new tables with the same properties as the tables in Source. Source may be either Document or Database. If one of the databases does not belong to a document then attribute tables are not copied. The new tables are empty. If WithViews = True then all views are also copied from Source. Example
Dim D1 As Database, D2 As Document D1.CopyDatabaseSkeleton D2
CopyDatabase Parameters
Source As Variant, Optional WithViews As Boolean = True
Description CopyDatabase deletes all tables and queries from the database and then creates new tables with the same properties. Source may be either Document or Database. If one of the databases does not belong to a document then attribute tables are not copied. The new attribute tables are empty. Data of directory tables are copied If WithViews = True then all views are also copied from Source. Example
Dim D1 As Database, D2 As Document D1.CopyDatabase D2
PurgeDatabase Parameters None Description PurgeDatabase removes all pending references. This means that all columns that contain references : (1) DataType=vbObject (2) Not ReferencedColumn Is Nothing and containing a value (not being Null) are investigated. ptPendingLeave : leaves pending references untouched. ptPendingNull : pending references are set = Null. ptPendingDelete : pending references are removed. This method eliminates all pending references. A not NULL value is considered to be a pending reference when one of the following conditions are met : 1) DataType=vbObject for this column and there is no CAD object with such identifier;
Database
Page 40-9
2) Not ReferencedColumn Is Nothing and there is no row with such value in the referenced column. All pending references in columns where PendingAction=ptPendingNull are changed to Null. All rows with pending references in columns where PendingAction=ptPendingDelete are deleted. See also DBTableColumn properties ReferencedColumn and PendingAction. Example
DropDatabase Parameters None Description DropDatabase deletes all tables and queries except system tables. All data are lost. Note: to eliminate a Pythagoras database from memory rather CloseDatabase then this method is to be used. Example
Dim D As Database D.DropDatabase
CloseDatabase Parameters
None
Description This method is ignored being applied to a document database. Otherwise it deletes the database from the memory. On return the database object becomes Nothing. This method is also called implicitly when the last reference to the Pythagoras database is cleared. Here a reference is understood as either a direct referencean object of class Database or an indirect referencean object of another class (DBTable, DDBRow etc.). Example
Dim DB As Database Set DB = New Database ' Do something with Database DB.CloseDatabase
NewState Parameters
None
Database
Page 40-10
Description NewState starts a new state in Pythagoras database so that all operations done on a database after NewState call can be undone by EndState False call. When a VB program contains no Database.NewState method call(s), Pythagoras will automatically add a new state for each Pythagoras database that is changed by the VB program. This call cannot be applied to a document database. Example See example EndState. EndState Parameters
KeepChanges As Boolean
Description This method terminates the state initiated by NewState. If the parameter KeepChanges = False then all changes made on the document between NewState and EndState will be removed. This feature is useful to undo changes when an operation cannot be successfully terminated. EndState True has an only effect that any subsequent change of the database will open a new state. This call cannot be applied to a document database. Example
Dim DB As Database On Error GoTo ErrorHandle DB.NewState ' processing & creating database objects. ' If an error occurs, the code after the label ErrorHandle will restore ' the database to the original state Exit Sub ErrorHandle : Doc.EndState False
Description LockDatabase locks the database. The Owner and Password are remembered and then are to be stored to the file. They are required to unlock the database. Return is True if the database becomes locked. Return is False if the database is already locked. The method can be applied to Pythagoras database but does not seem to be useful. Example
Dim D As Database Dim Ok As Boolean Ok = D.LockDatabase("Admin", "v1fG9ty")
Database
Page 40-11
Description UnlockDatabase unlocks the database if the Owner and Password match with the values defined in LockDatabase method. Return is True if either the database was locked and Owner andPassword are correct, or the database was unlocked. Example
Dim D As Database Dim Ok As Boolean Ok = D.UnlockDatabase("Admin", "v1fG9ty")
ActualizeQueries Parameters None Description This method recalculates some internal structures in the database to guarantee query data be actual. Data returned by some query depends on table data and for document databases also from CAD object properties. To accelerate getting query data some internal structures are built. For reason of speed these internal structures are not recalculated each time when table or object data changes. This means that if the program goes through rows of a query and in parallel changes table data or object properties then some gotten query row data could be wrong. A call of this method guarantees that the program will get correct query data at least until next table data or object property change. Note that query data is actualized also in the following cases: When subdocument is added, deleted, is awaked up or goes to sleep When one of the following methods is called: Document.NewState, Document.EndState, Database.NewState or Database.EndState. When structure of the database changes. Note also that as a result of query data actualization position in a query may be lost, and the program may get error 2090 when trying to get next query row. Example
Dim Q As DBQuery, Row As DBRow, Id As Long, P As Point P.PointIdent = "23874" ' This method call may change values in query Q Q.Database.ActualizeQueries Row = Q.RowById(Id) ' Reread a row
Database
Page 40-12
Chapter 41 - DBTable
Description The DBTable object corresponds with a database table in a Pythagoras drawing. There are 2 types of tables : (1) Attribute table : each row in an attribute table linked to one CadObject. Example : table Countries containing fields Population, Area, Language. Polygons that represent countries link to the rows of the table. (2) Dictionary table : a table that is not linked or not directly linked to CadObjects. Example : table Languages containing fields Name, Description. Table contains a list of all languages with a description. Attribute tables and dictionaries can refer to dictionary tables. Attribute tables can also refer to CAD objects. See DBTableColumn class ReferencedColumn property description. Documents containing subdocuments: When reading subdocuments a conflict can occur that there are 2 or more tables with the same name. 1. Tables with the same name and different structure: this is not allowed. A subdocument will remain sleeping. 2. Attribute tables with same name and identical structure: the tables are joined together (Union), if structure of the table changes, the table is updated in all subdocuments. 3. Dictionary tables with same name and identical structure but different data: this situation is not allowed. A subdocument will remain sleeping. 4. Dictionary tables with same name and identical structure and data: a table in subdocument is ignored. If the structure or data of the table change, the table is updated in all subdocuments. Example
Option MSCompatible Dim Dim Dim Dim Dim Dim Dim Dim Dim Dim Dim A As Application Doc As Document Country As DBTable, Place As DBTable CountryCode As DBTableColumn Column As DBTableColumn Row As DBRow Values() As ColumnValue Coord As XYZ Ov As Overlay P As Point Brussels As Point
Set A = New Application A.GetNewDocument Doc Doc.GetOverlay ptDrawing, Ov 'Create Table Set Country = Doc.CreateTable(ptDictionary, "Country") Set Place = Doc.CreateTable(ptAttrTable, "Place", ObjectTypes:=ptPoint) 'Add Columns Set CountryCode = Country.AddColumn("Code", vbString, Indexed:=True, _ MayBeNull:=False) Set Column = Country.AddColumn("Name", vbString) Set Column = Place.AddColumn("Name", vbString) Column.Indexed = True Set Column = Place.AddColumn("Country", vbString, _ ReferencedColumn:=CountryCode, MayBeNull:=False) Column.Description = "Country code by ISO 3166" Set Column = Place.AddColumn ("Population", vbLong) Column.Minimum = 1000 Column.Maximum = 1000000000 ' Insert countries
DBTable
Page 41-1
Redim Values(0 To 1) Values(0) = A.ColumnValue("Code", "B") Values(1) = A.ColumnValue("Name", "Belgium") Country.InsertRow Values ' Insert places: both points and table rows Redim Values(0 To 2) Coord.X = 0. Coord.Y = 7. Coord.Z = 0. Ov.CreatePoint Coord, Brussels Values(0) = A.ColumnValue("Name", "Brussels") Values(1) = A.ColumnValue("Country", "B") Values(2) = A.ColumnValue("Population", 1000000) Brussels.SetData Place, Values
Properties
Document Name Description TableType ObjectTypes Access NrOfColumns NrOfRows DataStamp Identical GetColumn AddColumn DropColumn InsertRow FirstRow (obsolete) NextRow (obsolete) LastRow (obsolete) PreviousRow (obsolete) GetRows RowById DeleteRow FirstSubDocument NextSubDocument GetSubDocuments Clear FastClear CopyData
Methods
Properties
Document Returns
Database
Name Returns
String
DBTable
Page 41-2
Description Sets or returns the name of the table. Table names in Pythagoras are not case sensitive. Example
Dim T As DBTable T.Name = "Countries" MsgBox T.Name
Description Returns
String
TableType Returns
Byte
Description Returns the type of the table. The return value is either ptAttrTable or ptDictionary. Example
Dim T As DBTable If T.TableType = ptAttrTable Then 'Do Something End If
ObjectTypes Returns
Long
Description Returns or sets the CAD Object types that may be linked to this table. ObjectTypes must be equal to 0 if Type = ptDictionary. If Type = ptAttrTable then ObjectTypes may not be equal to 0. Its value is either ptPoint, ptLine, ptArc, ptClothoid, ptText, ptRichText, ptImage, ptCurve, ptPath, ptPolygon, ptCircle, ptRoad or the sum of any combination of these constants. The constant ptAllDBLinkable is equal to the sum of all the above object types. To test if the table can be linked to one or more object types, the logical operator And, may be used. See example. Example
Dim T1 As DBTable, T2 As DBTable, T3 As DBTable Dim D As Document T1.ObjectTypes = ptAllDBLinkable T2.ObjectTypes = ptLine + ptArc + ptClothoid + ptCurve T3.ObjectTypes = T2.ObjectTypes If (T1.ObjectTypes And ptImage) <> 0 Then MsgBox "Images my be linked to table" End If
Access Returns
Byte
DBTable
Page 41-3
Description Returns or sets the access rights of the table. A table can have the following access rights: ptNoAccess The data is read and write protected. Read, write and delete are not permitted. ptReadOnly The data may only be read. ptReadWrite The data may be read, written or deleted. ptFullAccess No restrictions. Only when Access = ptFullAccess, the structure and properties of the table may be changed. In all the other cases the structure and properties of the table may not be changed. This property in combination with the Document property LockedDatabase can be used to control the way a database can be accessed. If the user does not know the owner and password of locked database, only a VBA macro that temporarily unlocks the database can control the way the user reads and modifies the data. The macro can have forms to control these actions. Example
Dim T As DBTable T.Access = ptReadOnly
NrOfColumns Returns
Long
NrOfRows Returns
Long
DataStamp Returns
UUID
Description Returns a unique value that reflects the state of all data (all rows) of a dictionary table. This property can be used to check if the contents of dictionary tables in 2 documents are identical. The structure of the table (names of columns, etc) is not included in the DataStamp, only the content. To compare the structure, the method Identical should be used. For attribute tables this option is not supported. NilUUID is always returned. Note : Equality of data stamp guarantees that the data of 2 tables is identical. However two identical tables, e.g. when they have been filled separately, may have different data stamps. Example
Dim A As Application Dim T1 As DBTable, T2 As DBTable
DBTable
Page 41-4
If A.EqualUUID(T1.DataStamp, T2.DataStamp) Then ' Tables T1 and T2 contain the same data. End If
Methods
Identical Parameters Returns
Table As DBTable, Optional WithReferences As Boolean = False Boolean
Description Identical returns True if this table and Table have identical structures. This means that the names and all other table properties, the number of columns, their names and properties are equal. If WithReferences = False, then the references to other columns are not compared. If WithReferences = True, then the references to other columns are compared. Column references are equal if the names of the tables and columns they refer to are equal. Example
Dim T1 As DBTable, T2 As DBTable If T1.Identical(T2, True) Then ' Tables inclusive the references are identical End If
GetColumn Parameters
Column As Variant (Subtype of Column is either Integer or String)
Returns
DBTableColumn
Description GetColumn returns the column specified by parameter Column. Column : contains either the sequence number or the name of the column. Example
Dim T As DBTable Dim Column As DBTableColumn Dim ColumnName As Variant ColumnName = "Population" Set Column = T.GetColumn(ColumnName)
AddColumn Parameters
Name As String, DataType As Byte, Optional Description As String, Optional ObjectTypes As Long, Optional Display As Boolean = True, Optional MyBeNull As Boolean = True, Optional Changeable As Boolean = True, Optional Minimum As Variant = Null, Optional Maximum As Variant = Null, Optional Default As Variant = Null, Optional Fractional As Byte = 6, Optional ReferencedColumn As DBTableColumn = Nothing, Optional PendingAction As Byte = ptPendingLeave, Optional Indexed As Boolean = False Optional Unique As Boolean = False DBTableColumn
Returns
DBTable
Page 41-5
Description AddColumn adds a new column to the table with the specified properties. The new column becomes the last one. Name: the name of the column. Type: one of the following values : vbBoolean, vbDate, ptDateOnly, ptTime, vbDouble, vbLong, vbString, vbObject. Description: when empty string ("") or not specified, Description = Name. ObjectTypes: has only a meaning if DataType = vbObject. If the parameter DataType = vbObject and the ObjectTypes = 0 then ObjectTypes will be changed to ptAllDBLinkable. For more information see DBTableColumn property ObjectTypes. If DataType = vbObject then Indexedand Uniquemust be both = FALSE. If DataType = vbDouble then Uniquemust be both = FALSE. For the meaning of the other parameters see the DBTableColumn properties. Example
Dim Dim Dim Dim D As Document A As Application T As DBTable C1 As DBTableColumn, C2 As DBTableColumn, C3 As DBTableColumn
Set A = New Application A.GetActiveDocument D Set T = D.CreateTable(ptAttrTable, "Countries", ObjectTypes:=ptPolygon) Set C1 = T.AddColumn("Name", vbString, Description:="Name of country",_ Indexed:=True) Set C2 = T.AddColumn("Population", vbLong) Set C3 = T.AddColumn("Area", vbLong, Indexed:=True)
DropColumn Parameters
Column As DBTableColumn
Description DropColumn deletes the column from the table. All data of this column are lost. On return Column = Nothing. Example
Dim T As DBTable Dim C As DBTableColumn T.DropColumn C ' On return C = Nothing
Description InsertRow inserts a new row into a dictionary table. This method may not be used for an attribute table. Id: output parameter. Contains on return the assigned row identifier. Row: output parameter. Contains on return the new row. Example
Dim T As DBTable Dim Data() As ColumnValue Dim Id As Long Redim Data(1 To 3)
DBTable
Page 41-6
FirstRow Parameters
Optional SubDoc As SubDocument = Nothing, Optional ByColumn As Variant = Null, Optional From As Variant = Null DBRow
Returns
Description FirstRow returns the first row of a table. When the table is empty, Nothing is returned. SubDoc: if specified and not Nothing, then only rows of the specified subdocument will be returned. If SubDoc = Nothing, the rows of all non-sleeping documents will be taken into account. ByColumn: if specified and not Null, then the rows are considered to be sorted by this column. The specified column must be indexed (see DBTableColumn class property Indexed). The column is specified either by name or by sequence number. First column = sequence number 0. From: if specified and not Null, then the first row with value in the specified column >= From will be returned. A call to FirstRow will normally be followed by a series of calls to NextRow. Note: The DBTablemethod FirstRow is obsolete. We recommend to use the DBRows methodFirstRow. The new methods allow concurrent and nested access to rows of a table. For more information see DBRows. Example
Dim T As DBTable Dim Row As DBRow Set Row = T.FirstRow(ByColumn:=2) While Not Row Is Nothing ' Treat row Set Row = T.NextRow Loop
NextRow Parameters
None
Returns
DBRow
Description NextRow returns the next row of the table. When there is no next row, Nothing is returned. A sequence of calls to NextRow must have been preceded by a call to FirstRow. NextRow takes into account all parameters specified when FirstRow was called. Note: The DBTablemethod NextRow is obsolete. We recommend to use the DBRows methodNextRow. The new methods allow concurrent and nested access to rows of a table. For more information see DBRows. Example
Dim T As DBTable Dim Row As DBRow Set Row = T.NextRow
LastRow Parameters
Optional ByColumn As Variant
DBTable
Page 41-7
Returns
DBRow
Description LastRow returns the last row of a table. When there the table is empty, Nothing is returned. A call to LastRow will normally be followed by a series of calls to PreviousRow. ByColumn: see FirstRow description. Note: The DBTablemethod LastRow is obsolete. We recommend to use the DBRows methodLastRow. The new methods allow concurrent and nested access to rows of a table. For more information see DBRows. Example
Dim T As DBTable Dim Row As DBRow Set Row = T.LastRow(ByColumn:="Area") While Not Row Is Nothing ' Treat rows : descending order by "Area" Set Row = T.PreviousRow Loop
PreviousRow Parameters
None
Returns
DBRow
Description PreviousRow returns the previous row of the table. When there is no previous row, Nothing is returned. A sequence of calls to PreviousRow must have been preceded by a call to LastRow. PreviousRow takes into account ByColumn parameter specified when LastRow was called. Note: The DBTablemethod PreviousRow is obsolete. We recommend to use the DBRows methodPreviousRow. The new methods allow concurrent and nested access to rows of a table. For more information see DBRows. Example
Dim T As DBTable Dim Row As DBRow Set Row = T.PreviousRow
Description GetRows returns the set of rows of the table. The order of the rows depends on the internal structure of the table. As a consequence, no logic in the ordering may be assumed. Subdoc: if specified, then only the rows of the subdocument are in the set. If Subdoc = Nothing the rows of all non-sleeping subdocuments are included. Example
Dim T As DBTable Dim Rows As DBRows Dim Row As DBRow Set Rows = T.GetRows() Set Row = Rows.FirstRow() Do While Not Row Is Nothing ' Treat row
DBTable
Page 41-8
Description RowById returns the row identified by RowId of the dictionary table. This method may not be called for attribute tables. When there is no row with the given RowId, Nothing is returned. Example
Dim T As DBTable Dim Row As DBRow Set Row = T.RowById(3)
DeleteRow Parameters
Row As DBRow
Description DeleteRow deletes the given row of the dictionary table. This method may not be called for attribute tables. Instead the CadObject method DeleteData must be used. Example
Dim T As DBTable Dim Row As DBRow T.DeleteRow Row
FirstSubDocument Parameters
None
Returns
SubDocument
Description FirstSubDocument returns the first subdocument the table belongs to. Note: The DBTablemethod FirstSubDocument is obsolete. We recommend to use the DBSubDocuments methodFirstSubDocument. The new methods allow concurrent and nested access to subdocuments of a table. For more information see DBSubDocuments. For a table of a Pythagoras database (not linked to a document) this method will return Nothing. Example
Dim T As DBTable Dim SubDoc As SubDocument Set SubDoc = T.FirstSubDocument
NextSubDocument Parameters
None
Returns
SubDocument
Description NextSubDocument returns the next subdocument this table belongs to. Returns Nothing if the previous returned subdocument was the last one.
DBTable
Page 41-9
Note: The DBTablemethod NextSubDocument is obsolete. We recommend to use the DBSubDocuments methodNextSubDocument. The new methods allow concurrent and nested access to subdocuments of a table. For more information see DBSubDocuments. For a table of a Pythagoras database (not linked to a document) this method will return Nothing. Example
Dim T As DBTable Dim SubDoc As SubDocument Set SubDoc = T.NextSubDocument
GetSubDocuments Parameters
None
Returns
DBSubDocuments
Description GetSubDocuments returns the set of subdocuments the table belongs to. For a table of a Pythagoras database (not linked to a document) this method will return Nothing. Example
Dim T As DBTable Dim SubDocs As DBSubdocuments Dim SubDoc As SubDocument Set SubDocs = T.GetSubDocuments Set SubDoc = Subdocs.FirstSubDocument
Clear Parameters
None
FastClear Parameters
None
Description FastClear does the same as Clear, but also clears the history and therefore this operation can not be undone. This method is faster. Example
Dim T As DBTable T.FastClear
CopyData Parameters
Source As DBTable
Description CopyData deletes all rows from the current (destination) table and copies all rows from Source table to the current table. This method may only be applied to dictionary tables of identical structure. Before copying, the data of both tables are checked on equality (using the data stamps). If data are equal no actual copying is done.
DBTable
Page 41-10
Example
DBTable
Page 41-11
Chapter 42 - DBTableColumn
Description The DBTableColumn object defines one column of a table. Example
See example DBTable.
Properties
Table SeqOrder Name Description DataType ObjectTypes Display MayBeNull Changeable Minimum Maximum Default Fractional ReferencedColumn PendingAction Indexed Format Move GetRow GetRows
Methods
Properties
Table Returns
DBTable
Description Returns the database table that contains this column. Example
Dim T As DBTable Dim Column As DBTableColumn Set T = Column.Table
SeqOrder Returns
Integer
Description Returns the number of the column. Unlike SQL, the columns are numbered starting from 0. Example
Dim Nr As Integer Dim Column As DBTableColumn Nr = Column.SeqOrder
Name Returns
String
DBTableColumn
Page 42-1
Description Returns or sets the name of the column. The name of a column may not include spaces or control characters. Column names are not case sensitive. Eg names "PYTHAGORAS" and "Pythagoras" are considered equal. Example
Dim Name As String Dim Column As DBTableColumn Name = Column.Name
Description Returns
String
Description Returns or sets the description of the column of the table. Example
Dim Column1 As DBTableColumn, Column2 As DBTableColumn Column2.Description = Column1.Description
DataType Returns
Byte
Description Returns or sets the type of the data in the column. The DataType is one of the following values : vbBoolean, vbDate, ptDateOnly, ptTime, vbDouble, vbLong, vbString, vbObject. The type vbObject defines a column that references to a Cad Object in the drawing. When the type of a column is changed, the data of all rows is converted. The column properties Minimum, Maximum and Default are also converted to the new type. When the table is not empty and the conversion of the data of the column or of the properties Minimum, Maximum and Default is not possible for one or more rows, an error will be generated. Minimum and Maximum may be set to NULL when the new type is vbString or vbObject. When the type is set tovbObject, the property ObjectTypes becomesptAllDBLinkable. When the type was vbObject and is changed to another value, the property ObjectTypes becomes 0. A column of DataType = vbObject may only contain references to Cad Objects in the same document. Regarding pending references see also the Document method PurgeDatabase and the DBTableColumn property PendingAction. The property DataType of columns that are Indexed or with property MayBeNull = False can not be set to vbObject. The property DataType of columns that are Unique can not be set to vbDouble or to vbObject. Example
Dim Column As DBTableColumn Column.DataType = vbObject
ObjectTypes Returns
Long
Description The property ObjectTypes sets or returns the type of CAD Objects this column may refer to. This property has only a meaning if Type = vbObject. Else ObjectTypes must be= 0. The value is one of the following constants : ptAllDBLinkable, ptPoint, ptLine, ptArc, ptClothoid, ptText, ptRichText, ptImage, ptCurve, ptPath, ptPolygon, ptCircle, ptRoad or the sum of any of the above values.
DBTableColumn
Page 42-2
Before setting or modifying ObjectTypes, the property Type must be changed if required. If the new value of ObjectTypes conflicts with the actual value of Type, an error will be generated. Example
Dim Column As DBTableColumn Column.DataType = vbObject Column.ObjectTypes = ptPoint + ptLine ' Column refers to CadObject ' Only Points and Lines
Display Returns
Boolean
Description Sets or returns a flag that indicates if this column has to be displayed on the screen in a number of cases. This property is only meaningfull for attribute tables. Example
Dim Column As DBTableColumn Column.Display = True
MayBeNull Returns
Boolean
Description Sets or returns a flag indicating if the value in the column may be Null. A value = Null means that no value is assigned. NULL is different from all other possible values including an empty string. This property cannot be set to False when DataType = vbObject. Example
Dim Column As DBTableColumn Column.MayBeNull = False ' This column must have a value.
Changeable Returns
Boolean
Description Sets or returns a flag indicating if the data (stored in the rows) may be changed. Example
Dim Column As DBTableColumn Column.Changeable = False ' The data may not be changed.
Minimum Returns
Variant
Description Sets or returns the minimum value of this column. If Minimum = NULL, there is no minimum value. This property is always = NULL when DataType = vbString or DataType = vbObject. Example
Dim Column As DBTableColumn Column.DataType = vbLong Column.Minimum = -10 Column.Maximum = +10 Column.Default = 0
DBTableColumn
Page 42-3
Maximum Returns
Variant
Description Sets or returns the maximum value of this column. If Maximum = NULL, there is no maximum value. This property is always = NULL when DataType = vbString or Type = vbObject. Example
See property Minimum
Default Returns
Variant
Description Sets or returns the default value for this column. If Default = NULL, there is no default value. Example
See property Minimum
Fractional Returns
Byte
Description Sets or returns the number of fractional decimal places for columns of DataType = vbDouble. The property only affects the visual representation of the value of the column in dialog boxes of Pythagoras and sets the number of decimals when exporting data (DBF and Shape). Example
Dim Column As DBTableColumn Column.Fractional = 2 ' 123.456787 will be displayed as 123.46
ReferencedColumn Returns
DBTableColumn
Description ReferencedColumn defines the column of a table which is referenced by this column. The column on which this property is applied is called the referencing column. The column to which is referenced is called the referenced column. In the same respect the words referencing table and referenced table are used. The referenced table must be a dictionary table. References to attribute tables are not allowed. Type of referencing and referenced columns must be identical. Values in the referencing column are references. A value in the referencing column may be NULL which means that there is no reference. Otherwise they are treated as references to the rows of the referenced table, where values in the referenced column are the same. The referencing and referenced table must be in the same document. When a document is composed of subdocuments, referencing is allowed between subdocuments. If a reference is made to a dictionary table of another subdocument, then a copy of the referenced table is silently added to the referencing document. Only column with Unique=True can be referenced. Example
Dim Column As DBTableColumn Dim RefColumn As DBTableColumn Set Column.ReferencedColumn = RefColumn ' Reading If Column.ReferencedColumn Is Nothing Then
DBTableColumn
Page 42-4
PendingAction Returns
Byte
Description PendingAction returns or sets the type of action to be taken when the Document method PurgeDatabase is executed and the referencing column has pending references. PendingAction must have one of the following values : ptPendingLeave, ptPendingNull or PtPendingDelete. For detailed information what action is taken see the Document method PurgeDatabase. Example
Dim Column As DBTableColumn Column.PendingAction = ptPendingNull
Indexed Returns
DBTable
Description Sets or returns the indication if this column is indexed. When a column is indexed, a special structure called an index is build for the column. The index is used to find rows by values in the column faster. The DBTable method GetFirstRow with the ByColumn argument can only be applied to an indexed column. When setting Indexed = False then property Unique is automatically set to False. Value of this property cannot be set to False when the column is referenced and cannot be set to True when DataType = vbObjects. Example
Dim Column As DBTableColumn Column.Indexed = True
Unique Returns
Boolean
Description Sets or returns the indication if the column values (unless = Null) are unique for all rows. Only columns with the property Unique = True can be referenced from other columns. When setting Unique = True the property Indexed also changes automatically to True. Value of this property cannot be set to False when the column is referenced and cannot be set to True when DataType = vbObject or when Table.TableType = ptAttrTable. Example
Dim Column As DBTableColumn Column.Unique = True
Format Returns
String
Description Sets or returns a format string defining how data of type vbDate, ptOnlyDate or ptTime shoud be formatted during conversion to text. For columns of other types a value of the property is senseless. Example
Dim Column As DBTableColumn Page 42-5
DBTableColumn
Column.Format = "yyyy-MM-dd"
Methods
Move Parameters
N As Integer
Description Move changes the sequence number (SeqOrder property) of the column. The sequence number is incremented by N. If the result becomes less then 0 or greater or equal to the number of columns, the sequence number will get the minimum (0) or maximal (number of columns - 1) value. It is evident that the sequence number of other columns is adapted accordingly. Example
Dim Column As DBTableColumn Column.Move -1 ' Decrement sequence number by 1.
Description The method can only be applied to a column with property Unique = True. The method returns the row that contains the requested value (Key). The no row in the table with this value Nothing is returned. Example
Dim Column As DBTableColumn Dim Row As DBRow Set Row = Column.GetRow("Belgium") If not Row is Nothing Then ' Do something with the row (as long as you don't split up in 2 rows) End If
GetRows Parameters
None
Returns
DBRows
Description The method returns a set of all rows of the table ordered by the values in the column. The method can only be applied to a column with Indexed = True. Rows with Null values are not included in the set. Example
Dim Column As DBTableColumn Dim Rows As DBRows Dim Row As DBRow Set Rows = Column.GetRows() Set Row = Rows.FirstRow Do While Not Row Is Nothing ' Treat row Set Row = Rows.NextRow Loop
DBTableColumn
Page 42-6
Chapter 43 - DBQuery
Description An object of this class describes a DB query. DB queries can be one of the two following types: DB view and temporary queries. DB views have different names and are stable objects, i.e. are retained in the database until either a view is explicitly dropped or the whole database is dropped. Temporary queries can be created only via VBA code, they have no name. They are dropped in the same cases as DB views and additionally when the last reference to them is lost, in particular when a VBA library is unloaded. Example
Dim D As Database Dim Q As DBQuery Set Q = _ D.CreateSimpleQuery ( _ A.RowSetDefinition (ptTable,Name="Employees"), Employees2")
Properties
Database QueryType MainBaseDefinition AuxBaseDefiniton Name Description Where Preferences Match Validity ErrorIndex SyntaxError ErrorStart ErrorEnd NrOfWhereConditions NrOfColumns CADObjectLinked ObjectTypes Overlay Sheet GetWhere AddWhere AlterWhere MoveWhere DropWhere AddColumn GetColumn DropColumn GetRows RowById
Methods
Properties
Database Returns
Database
DBQuery
Page 43-1
Set D = Q.Database
QueryType Returns
PtQueryType
Description Returns or sets definition of the main or of the auxiliary base rowset correspondingly. AuxBaseDefinition property may be applied only to an aggregation query. Example
Dim Q As DBQuery, Def As RowSetDefinition ' Changing name of main base rowset (a table or a query) Def = Q.MainBaseDefinition Def.Name "Provinces" Q.MainBaseDefinition = Def
Name Returns
String
Description Returns or sets a name of the view. If the query is not a view then this property cannot be written and returns an empty string when read. Reading the property could be used to define if this query is a DB view. Example
Dim V As DBQuery V.Name = "View5"
Description Returns
String
Where Returns
String
Description Returns or sets a textual where condition. This condition is used additionally to other where conditions added by AddWhere method. An empty value means that the query contains no textual where condition.
DBQuery
Page 43-2
Example
Preferences Returns
Units
Description Sets or returns preferences used in this query. Preferences are used mainly when calculating expressions. Returned value subproperty assignment has no effect (see example below). Example
' We want to change item separator to semicolon ' (as used in Europe) Dim Q As DBQuery Dim Pref As Units Pref = Q.Preferences Pref.ItemSeparator = Asc(";") Q.Preferences = Pref ' Note that the following code has no effect : Q.Preferences.ItemSeparator = Asc(";")
Match Returns
MatchCondition
Description Sets or returns a match condition for the aggregation query. This property cannot be applied either to a simple query. Example
Dim Q As DBQuery Dim M As MatchCondition M.Kind = ptDistance M.Distance = 100 Q.Match = M
Validity Returns
PtQueryValidity
Description Returns information whether the query is valid (Validity=ptQueryValid) and if not what is an error. A query is valid when all its definitions are valid. This requirement means also that definitions of where conditions, dimensions and columns are valid. Data can be obtained only from valid queries. Additional information on the error is returned by properties ErrorIndex, SyntaxError, ErrorStart and ErrorEnd. Example
' ' ' ' Dim Q As DBQuery Check if the Q is valid and print message if not. An example contains some error codes that cannot occur in 13th version. They will be possible in 14th version of Pythagoras. Case ptQueryValid ' Do nothing Case ptQueryCircularQueries MsgBox "Circular reference of queries"
DBQuery
Page 43-3
Case ptQueryBadAliasName MsgBox CStr(Q.ErrorIndex) & "th dimension has illegal name Case ptQueryAliasNameRepeated MsgBox "In " & CStr(Q.ErrorIndex) & _ "th dimension alias name is repeated Case ptQueryBadViewName MsgBox "View name is invalid" Case ptQueryNoReferencedQuery Select Case Q.QueryType Case ptQueryExtension MsgBox _ "Reference to a query that " & _ "does not exist in " & _ CStr(Q.ErrorIndex) & "th dimension" Case ptQueryAggregation MsgBox _ "Reference to a query that does not exist" End Select Case ptQueryNoReferencedTable Select Case Q.QueryType Case ptQueryExtension MsgBox _ "Reference to a table that " & _ "does not exist in " & _ CStr(Q.ErrorIndex) & "th dimension" Case ptQueryAggregation MsgBox _ "Reference to a table that does not exist" End Select Case ptQueryNoReferencedSheet MsgBox "Reference to a sheet that does not exist" Case ptQueryBadLeftMatch MsgBox "Syntax error " & CStr(Q.SyntaxError) & _ " in left match expression of " & _ CStr(Q.ErrorIndex) & "th dimension, " & _ "positions " & CStr(Q.ErrorStart+1) & "-" & _ CStr(Q.ErrorEnd) Case ptQueryNoRightMatch MsgBox "Match column not found in " & _ CStr(Q.ErrorIndex) & "th dimension" Case ptQueryNotUniqueMatch MsgBox "Match column is not unique in " & _ CStr(Q.ErrorIndex) & "th dimension" Case ptQueryNoReferencedAlias MsgBox CStr(Q.ErrorIndex) & "th " & _ "where condition references not existing base" Case ptQueryNoReferencedColumn MsgBox CStr(Q.ErrorIndex) & "th " & _ "where condition references not existing column" Case ptQueryBadCondition MsgBox CStr(Q.ErrorIndex) & "th " & _ "where condition contains inconsistency" Case ptQueryBadWhereExpression MsgBox "Syntax error " & CStr(Q.SyntaxError) & _ " in where expression, positions " & _ CStr(Q.ErrorStart) & "-" & CStr(Q.ErrorEnd) Case ptQueryBadColumnExpression MsgBox "Syntax error " & CStr(Q.SyntaxError) & _ " in expression for " & CStr(Q.ErrorIndex) & _ "th column, positions " & _ CStr(Q.ErrorStart) & "-" & CStr(Q.ErrorEnd) Case ptQueryNoMirroredColumn MsgBox CStr(Q.ErrorIndex) & "th column definition " & _ "references not existing column" Case ptQueryBadAggregationMatch MsgBox "Incorrect match expression for " & _
DBQuery
Page 43-4
"an aggregation query" Case ptQueryBadSpatialAggregation MsgBox "An attempt to build a spatial aggregation " & _ "when one of base rowsets is not an attribute one" Case ptQueryBadAggregateType MsgBox "In " & CStr(Q.ErrorIndex) & _ "th column aggregate function is applied to " & _ "not proper data type" Case ptQueryBadColumnName MsgBox CStr(Q.ErrorIndex) & "th column has invalid name" Case ptQueryColumnNameRepeated MsgBox "In " & CStr(Q.ErrorIndex) & _ "th column name is repeated" Case ptQueryNoReferencedSheet MsgBox "Reference to a sheet that does not exist" Case ptQueryReferencesInvalidQuery Select Case Q.QueryType Case ptQueryExtension MsgBox _ "Reference to an invalid query in " & _ CStr(Q.ErrorIndex) & "th dimension" Case ptQueryAggregation MsgBox "Reference to an invalid query" End Select Case ptQueryNoReferencedQuery Select Case Q.QueryType Case ptQueryExtension MsgBox _ "Reference to a temporary query that " & _ "has been deleted in " & _ CStr(Q.ErrorIndex) & "th dimension" Case ptQueryAggregation MsgBox _ "Reference to a temporary query that " & _ "has been deleted" End Select Case ptQueryViewReferencesTempQuery Select Case Q.QueryType Case ptQueryExtension MsgBox _ "View base is a temporary query in " & _ CStr(Q.ErrorIndex) & "th dimension" Case ptQueryAggregation MsgBox "View base is a temporary query" End Select End Select
ErrorIndex Returns
Integer
Description Returns additional information about an error in query definition. Returned value has one of the following meanings: When Validity is ptQueryNoReferencedAlias, ptQueryNoReferencedColumn or ptQueryBadConditionsequential number of where condition which is erratic. When Validity is ptQueryBadColumnExpression, ptQueryNoMirroredColumn, ptQueryBadAggregateType or ptQueryBadColumnNamesequential number of column with error. Otheriwse no meaningful information is in the field. Example See property Validity example.
DBQuery
Page 43-5
SyntaxError Returns
PtSyntaxError
Description Returns additional information about an error in query definition. Returned value is an error code issued by the expression compiler during compilation of a textual expression. Returned value is meaningful only when Validity is one of ptQueryBadLeftMatch, ptQueryBadWhereExpression or ptQueryBadColumnExpression. Example See property Validity example. ErrorStart, ErrorEnd Returns
Long
Description Returns additional information about an error in query definition. Returned values are starting and final positions (numerated from 0) of a token in an expression string where the compiler found an error described by SyntaxError property. Returned values are meaningful only when Validity is one of ptQueryBadLeftMatch, ptBadQueryWhereExpression or ptBadQueryColumnExpression. Example See property Validity example. NrOfWhereConditions Returns
Integer
Description Returns number of where conditions defined for this query. This number does not include a textual where condition. Where conditions can be accessed using methods GetWhere, AddWhere, AlterWhere and DropWhere. Example
Q As DBQuery Dim NrWhere As Integer NrWhere = Q.NrOfWhereConditions
NrOfColumns Returns
Integer
Description Returns number of columns of the query. Column definitions can be accessed using methods GetColumnDefinition, AddColumn, AlterColumn, DropColumn and GetColumn. Example
Q As DBQuery Dim NrDim As Integer NrDim = Q.NrOfDimensions
CadObjectLinked Returns
Boolean
Description Returns True when rows of this query are linked to CAD objects. The property may be applied only to a valid query. Returned value is defined by the main base rowset definition. DBQuery
Page 43-6
Example
ObjectTypes Returns
Long
Description Returns the CAD object types that may be linked to this query. This property may be applied only to a valid query. Returned value is actually object types allowed for the main base rowset. 0 is returned when the query is not CAD object linked. Example
Dim Q As DBQuery If Q.Valid And (Q.ObjectTypes And ptPoint) <> 0 Then ' If points can be linked to the view then do something End If
Overlay Returns
Overlay
Description Returns an overlay CAD objects linked to the query belong to. The property may be applied only to a valid query. Being applied to a not CAD linked query it returns Nothing. Example
Dim Q As DBQuery, Ov As Overlay If Q.Overlay Is Ov Then ' If Q contains objects of Ov then do something End If
Sheet Returns
Sheet
Description Returns a sheet CAD objects linked to the query belong to. The property may be applied only to a valid query. Being applied to a not CAD object linked query it returns Nothing. Also Nothing is returned when the query is applied to the local overlay. Example
Dim Q As DBQuery, Sh As Sheet If Q.Sheet Is Sh Then ' If Q contains objects of Sh then do something End If
Methods
GetWhere Parameters Returns
Index As Integer WhereCondition
DBQuery
Page 43-7
Description GetWhere returns the where condition specified by Index. Conditions are indexed starting from 0. Condition with Compare=ptCompareNil is returned if there is no such where condition. Example
Dim I As Integer, N As Integer Dim Q As DBQuery Dim Conditions() As WhereCondition N = Q.NrOfWhere If N > 0 Then ReDim Conditions(N-1) For I = 0 To N-1 Conditions(I) = Q.GetWhere(I) Next End If
Description AddWhere adds new where condition, which becomes the last one. The index of the added condition is returned. Where.ValueType is meaningful only in such combinations: Where.Value is of type vbDate and Where.ValueType is equal either to ptDateOnly or ptTime Where.Value is of one of integer types and Where.ValueType=ptCadObjectType In these cases Value of the new where condition will have type defined by Where.ValueType. Otherwise Where.ValueType is ignored. Example
Dim A As Application Dim N As Integer Dim Q As DBQuery N = _ Q.AddWhere ( _ A.WhereCondition (ptCompareGreaterEqual, "Population", _ Value:=1000000) _ )
AlterWhere Parameters
Index As Integer, Where As WhereCondition
Returns None Description AlterWhere changes the where condition specified by Index. DataType of an argument must correspond to type of a query. An error is raised when there is no such where condition. Where.ValueType is treated in the same way as by AddWhere method. Example
Dim N As Integer Dim Q As DBQuery Dim Condition As WhereCondition Condition = Q.GetWhere(2) Condition.Value = 100000 Q.AlterWhere 2, Condition
DBQuery
Page 43-8
MoveWhere Parameters Returns None Description MoveWhere changes order of where conditions. Where condition with index = Index is moved to have an index = NewIndex. If NewIndex is too small or too big, then the condition becomes correspondingly 0th or the last. Relative order of other where conditions does not change. Example
Dim Q As DBQuery Q.MoveDimension 1, 0 ' Exchange 0 and 1 where conditions Index As Integer, NewIndex As Integer
DropWhere Parameters Returns None Description DropWhere deletes the where condition specified by Index. Next conditions are moved left. An error is raised when there is no such where condition. Example
Dim Q As DBQuery While Q.NrOfWhere > 0 Q.DropWhere 0 WEnd Index As Integer
Description AddColumn adds new column to the query, the new column becomes the last one. The index of the added column is returned. Example
Dim A As Application Dim N As Integer Dim Q As DBQuery N = _ Q.AddColumn ( _ A.ColumnDefinition ("Density", IsComputed:=True, _ Expression:="Population/Area()") _ )
GetColumn Parameters
Index As Variant (Integer or String)
Returns
DBQueryColumn
DBQuery
Page 43-9
Description GetColumn returns a column found by an index or a name. Nothing is returned when there is no such column. Example
Dim I As Integer, N As Integer Dim Q As DBQuery Dim Columns() As DBQueryColumn N = Q.NrOfColumns If Q.Valid And N > 0 Then ReDim Columns(N-1) For I = 0 To N-1 Columns(I) = Q.GetColumn(I) Next End If
DropColumn Parameters
Index As Variant (Integer or String)
Returns None Description DropColumn deletes column found by an index or by a name. Next columns are moved left. An error is raised when there is no column with such index. Nothing is done when there is no column with such name. Example
Dim Q As DBQuery While Q.NrOfColumns > 0 Q.DropColumn 0 WEnd
Description GetRows returns a set of rows of the query ordered by some internally defined order. SubDoc: if specified and not Nothing, then only rows of the specified subdocument are included. If SubDoc = Nothing, the rows of all non-sleeping documents are included. Example
Dim Q As Query Dim Rows As DBRows Dim Row As DBRow Set Rows = Q.GetRows() Set Row = Rows.FirstRow() While Not Row Is Nothing ' Treat row Set Row = Rows.NextRow() WEnd
DBQuery
Page 43-10
Description RowById returns a row identified by RowId of the query. This method may be called only for valid, not CAD object linked queries (see corresponding properties). When there is no row with the given RowId, Nothing is returned. Example
Dim Q As DBQuery Dim Row As DBRow Set Row = Q.RowById(3)
DBQuery
Page 43-11
Chapter 44 - DBQueryColumn
Description An object of this class represents a column of a query. Unlike other database objects (classes DBTable, DBTableColumn, DBQuery, DBRow) query columns have no unique identifier, therefore a query column is internally identified by query unique identifier and sequential number of the column. Therefore, if query columns have been inserted, moved or deleted, it can happen that an object of this class will point to another column of the same query having the same sequential number. Example
Dim Q As DBQuery, C As DBQueryColumn Set C = Q.GetColumn (0)
Properties
Methods
Properties
Properties Name, Description, Format and Fractional are similar as the corresponding properties of DBTableColumn class; see their descriptions. Query Returns
DBQuery
SeqOrder Returns
Integer
Description Returns a sequential number of the column in a query. Columns are numbered starting from 0. Example
Dim Nr As Integer Dim Column As DBQueryColumn Nr = Column.SeqNumber
Definition Returns
ColumnDefinition
DBQueryColumn
Page 44-1
DataType Returns
Byte
Description Returns data type of the column. If the query is valid then data type of the column is returned which may be: vbBoolean, vbDate, ptDateOnly, ptTime, vbDouble, vbLong, vbString, vbObject, ptType. Otherwise vbError is returned. Example
Dim Column As DBQueryColumn If Column.DataType = vbString Then ' do something End If
Methods
Move Parameters Returns None Description Move changes the sequence number (SeqOrder property) of the column. The sequence number is incremented by N. If the result becomes less than 0 or greater or equal to the number of columns, the sequence number will get the minimum (0) or maximal (number of columns - 1) value. It is evident that the sequence number of other columns is adapted accordingly. Example
Dim Column As DBQueryColumn Column.Move 32000 ' Move column "Weight" to the end N As As Integer
DBQueryColumn
Page 44-2
Chapter 45 - DBRow
Description The DBRow object refers to one row of a rowset. A row of a table is set of data that may be read, written, changed or deleted. A row of a query is calculated when it is read, therefore it cannot be written, changed or deleted. Example
See example DBTable
Properties
Table Query LinkedObject Id Overlay Sheet GetAll GetValue SetValue GetStringValue Update Identical
Methods
Properties
Table Returns
DBTable
Description Returns the table this row belongs to. If this row belongs to a query, Nothing is returned. Example
Dim T As DBTable Dim R As DBRow Set T = R.Table
Query Returns
DBQuery
Description Returns a query the row belongs to. If this row belongs to a table, Nothing is returned. Example
Dim Row As DBRo If Not Row.Query Is Nothing And Row.Query.Name = "PolesA" Then ' Do something
LinkedObject Returns
CadObject
Description Returns the CadObject that is linked to the row. This property is only applicable to rows of rowsets linked to CAD objects, i.e. to when the rowset is either an attribute table or a set of objects or a query with CADObjectLinked=True. Example
Dim Obj As CadObject Page 45-1
DBRow
Id Returns
Long
Description Returns the unique row identifier. This property is only applicable to rows of a rowsets not linked to CAD objects. Each row in a dictionary table has a unique identifier that is assigned when the row is created. The unique identifier of a row never changes. Rows of not CAD linked objects queries are assumed to have the same identifiers as rows of the main base rowset they are built from. Example
Dim R As DBRow Dim RowId As Long RowId = R.Id
Overlay Returns
Overlay
Description Returns an overlay the row belongs to. For a row of a dictionary table returned value is Nothing. For a row of an attribute table the local overlay of the document the table belongs to is returned. For a row of a query returned value is the same as for DBQuery.Overlay property. For Pythagoras databases returned value is Nothing always. Example
Dim Row As DBRow, Ov As Overlay If Row.Overlay Is Ov Then ' If row belongs to Ov then do something End If
Sheet Returns
Sheet
Description Returns a sheet the row belongs to. For a row of a table Nothing is returned. For a row of a query returned value is the same as for DBQuery.Sheet property. For Pythagoras databases returned value is Nothing always. Example
Dim Row As DBRow, Sh As Sheet If Row.Sheet Is Sh Then ' If row belongs to Sh then do something End If
Methods
GetAll Parameters
Data() As ColumnValue, Optional ReturnNames As Boolean = False
DBRow
Page 45-2
Description This method returns all data from a row. The data is stored in an array of ColumnValues. When the optional parameter ReturnNames = True, then the Column-fields will contain the names of the columns. Else the field contains the sequence number of the column. Example
Dim Data() As ColumnValue Dim R As DBRow R.GetAll Data R.GetAll Data, True ' Column fields of Data contain sequence number. ' Column fields of Data contain the name of the column.
Description The methodGetValue returns the value of the specified column. The parameter Column is either the sequence number of the column (0 .. n-1) or the name of the column. Example
Dim R As DBRow Dim Population As Long Population = R.GetValue("Population")
SetValue Parameters
Column As Variant, Value As Variant
Description The method SetValue changes the value of the specified column. The parameter Column is either the sequence number of the column (0 .. n-1) or the name of the column. This method can be applied only to a table row. Example
Dim R As DBRow R.SetValue 1, 11450000
Description This method differs from GetValue method only in that that a value is converted to string. Conversion from date/time types is done using Format property of the column. Conversion from floating point type is done with number of decimal digits defined by Fractional property of the column. Example
Dim Row As DBRow MsgBox "Deadline is " & Row.GetStringValue("DeadLine")
Update Parameters
Data() As ColumnValue
DBRow
Page 45-3
Description The method Update changes the values of the specified columns. This method can be applied only to a table row. Example
Dim R As DBRow Dim Data() As ColumnValue R.Update Data
Identical Parameters
Row As DBRow
Description Identical compares two rows. The method returns true if all columns contain the same value. This method may only be applied on rows of tables that have an identical structure (see DBTable method Identical). Example
Dim R1 As DBRow, R2 As DBRow If R1.Identical(R2) Then ' Content of R1 and R2 are identical End If
DBRow
Page 45-4
Chapter 46 - DBRows
Description The DBRows object refers to a set of rows of a rowset. The set of rows of a table may be ordered by an indexed column. The DBRows object is created by method GetRows of one of classes: DBTable, DBTableColumn or DBQuery. Example
See example DBTableGetRows.
Properties
Methods
Properties
Table Returns
DBTable
Query Returns
DBQuery
Description Returns the query these rows belong to. If these rows belong to a table then Nothing is returned. Example
Dim Q As Query Dim Rows As DBRows Set Q = Rows.Query
Subdocument Returns
Subdocument
Description Returns the subdocument specified when the object was created or Nothing. Example
Dim SubDoc As SubDocument Dim Rows As DBRows Set SubDoc = Rows.Subdocument
DBRows
Page 46-1
ByColumn Returns
DBTableColumn
Description This property returns the table column used to create the DBRows object or Nothing. Example
Dim Column As DBTableColumn Dim Rows As DBRows Set Column = Rows.ByColumn
Methods
FirstRow Parameters Returns
Optional From As Variant = Null DBRow
Description This method returns the first row, or the requested row (if parameter From <> Null), of the set. The order of the rows in the set has been defined during creation of the set. From: if specified and not Null, then the first row in the set with value in the specified column (see DBTableColumn method GetRows) >= From will be returned. Example
Dim Column As DBTableColumn Dim Rows As DBRows Dim Row As DBRow Set Rows = Column.GetRows() ' return all rows starting from 100 Set Row = Rows.GetFirstRow(100) Do While Not Row Is Nothing ' Treat row Set Row = Rows.NextRow() Loop
Description This method returns the next row of the set. Example
Dim Column As DBTableColumn Dim Rows As DBRows Dim Row As DBRow Set Rows = Column.GetRows() Set Row = Rows.FirstRow("P") Do While Not Row Is Nothing ' Treat row Set Row = Rows.NextRow() Loop
DBRows
Page 46-2
Description This method returns the last row of the set. When the set is empty, Nothing is returned. A call to LastRow will normally be followed by a series of calls to PreviousRow. The method can not be applied to sets created by DBTableColumn method GetRows with as SubDoc argument <>Null. Example
Dim T As DBTable Dim Rows As DBRows Dim Row As DBRow Set Rows = T.GetRows() Set Row = Rows.LastRow Do While Not Row Is Nothing ' Treat row Set Row = Rows.PreviousRow() Loop
Description This method returns the previous row of the set. When there is no previous row, Nothing is returned. Example
Dim Column As DBTableColumn Dim Rows As DBRows Dim Row As DBRow Set Rows = Column.GetRows() Set Row = Rows.LastRow Do While Not Row Is Nothing ' Treat row Set Row = Rows.PreviousRow() Loop
DBRows
Page 46-3
Chapter 47 - DBSubDocuments
Description The DBSubDocuments object is a set of all subdocuments that make up a database table. Example
Dim Dim Dim Dim Dim Dim A As Application SubDocs As DBSubDocuments SubDoc As SubDocument Doc As Document Table As DBTable i As Long
Set A = New Application A.GetActiveDocument Doc Set Table = Doc.TableByName("Pales") Set SubDocs = Table.GetSubDocuments() Set SubDoc = SubDocs.FirstSubDocument For i = 1 To SubDocs.NrOfSubDocuments - 1 Set SubDoc = SubDocs.NextSubDocument Next i
Properties
Methods
Properties
Table Returns
DBTable
Description Returns the table the DBSubDocument object belongs to. Example
Dim T As DBTable Dim SubDocs As DBSubDocuments Set T = SubDocs.Table
NrOfSubDocuments Returns
Long
Description This property returns the number of subdocuments in the set. Example
Dim SubDocs As DBSubDocuments Nr = SubDocs.NrOfSubDocuments
Methods
FirstSubDocument Parameters None
DBSubDocuments
Page 47-1
Returns
SubDocument
Description This method returns first SubDocument of the set. Example See example at introduction of the class DBSubDocuments FirstSubDocument Parameters None Returns
SubDocument
Description This method returns the next SubDocument of the set. This method must have been preceded by FirstSubDocument. Example
See example at introduction of the class DBSubDocuments
DBSubDocuments
Page 47-2
Chapter 48 - Layer
Description The Layer object corresponds with a Layer in a Pythagoras drawing. See also the object type Layers. Example
Dim Dim Dim Dim Dim Dim A As Application Doc As Document Ls As Layers L As Layer i As Integer LayerNames() As String
Set A = New Application A.GetActiveDocument Doc If NOT Doc is nothing Then Doc.GetLayers Ls ReDim LayerNames(1 To Ls.NrOfLayers) Ls.GetFirst L For i = 1 To Ls.NrOfLayers LayerNames(i) = L.Name Ls.GetNext L Next i End if
Properties
Methods
Properties
Name Returns
String
Protected Value
Boolean
Layer
Page 48-1
Visible Value
Boolean
Description Returns or sets the visible flag of the layer. The active layer can not be set invisible. Example
Dim L1 As Layer, L2 As Layer L1.Visible = L2.Visible
Wallpaper Value
Boolean
Description Returns or sets the snapping disabled flag of the layer (formerly SnappingDisabled) Example
Dim L1 As Layer, L2 As Layer L1.SnappingDisabled = L2.SnappingDisabled
MinimumScale Value
Double
Description Returns the scale that is the lower boundary at which the layer should be displayed. Example
Dim L As Layer Dim Minimum As Double Minimum = L.MinimumScale
MaximumScale Value
Double
Description Returns the scale that is the upper boundary for displaying the layer. Example
Dim L As Layer Dim Maximum As Double Maximum = L.MaximumScale
CanBeDeleted Value
Boolean
Description Returns True if the layer can be deleted. A layer can only be deleted is there are no objects in it. Example
Dim L As Layer Dim Ls As Layers If L.CanBeDeleted Then Ls.DeleteLayer L End If
Layer
Page 48-2
Methods
SetMinimumAndMaximumScale Parameters
MinimumScale As Double, MaximumScale As Double
Description Sets the minimum scale and maximum scale at which the layers should be displayed. MinimumScale must be less then MaximumScale. MinimumScale = ptMinDouble if the layer has to be displayed at any scale up to MaximumScale. MaximumScale = ptMaxDouble if the layer has to be displayed starting from MinimumScale. Example
Dim L As Layer L.SetMinimumAndMaximumScale 1/1000.0, ptMaxDouble
Layer
Page 48-3
Chapter 49 - Layers
Description An instance of an object Layers refers to all layers in a Pythagoras drawing. This object type allows obtaining all layers of a document, but also to create and to delete layers. Pythagoras uses internally a layer called System Layer. Objects, currently only points, lines and clothoids, that are in the System Layer are not visible to the user. In Pythagoras objects in the System Layer are automatically created in some cases, e.g. when creating a polygon. Objects in the System Layer will automatically be deleted by Pythagoras if possible. The System Layer does not appear in dialog boxes. An instance of an object Layers does not include the System Layer! As a consequence an object Layer will never refer to the System Layer. Be careful putting objects in the System Layer. When there is no reference to those objects, Pythagoras may delete them. Example
See Layer
Properties
NrOfLayers Protected Visible Wallpaper GetFirst GetNext GetActiveLayer SetActiveLayer GetLayer NewLayer DeleteLayer DeleteEmptyLayers
Methods
Properties
NrOfLayers Returns
Long
Protected Value
Boolean
Description Sets or resets the protected flag for all layers in the group. Example
Dim LG As LayerGroup LG.Protected = True
Visible Value
Boolean
Layers
Page 49-1
Description Sets or resets the visible flag for all layers in the group. Example
Dim LG As LayerGroup LG.Visible = True
Wallpaper Value
Boolean
Description Sets or resets the wallpaper flag for all layers in the group. Example
Dim LG As LayerGroup LG.Wallpaper = True
Methods
GetFirst Parameters
L As Layer
GetNext Parameters
L As Layer
GetActiveLayer Parameters
L As Layer
Layers
Page 49-2
SetActiveLayer Parameters
L As Layer
Description Makes L the active layer. This operation has no effect if the document containing the layer L is not the top window. Example
Dim Ls As Layers Dim L As Layer Ls.SetActiveLayer L
GetLayer Parameters
LayerName As Name, L As Layer
Description Returns the layer with the given name. If the layer with the given name is not found, then on return L = Nothing. If the LayerName = "~SYSTEM~" (name of the System Layer), then on return L = Nothing. Example
Dim Ls As Layers Dim L As Layer Ls.GetLayer "Buildings", L If Not (L Is Nothing) Then L.Visible = True End If
NewLayer Parameters
LayerName As Name, L As Layer
Description Creates a new layer with the given name. If the layer with the given name already exists, then the parameter L will refer to the existing layer. So NewLayer may be used in stead of GetLayer. If the LayerName = "~SYSTEM~" (name of the System Layer), then on return L = Nothing. Example
Dim Ls As Layers Dim L As Layer Ls.NewLayer "Buildings", L L.Protected = True
DeleteLayer Parameters
L As Layer
Description Deletes the layer from the document if the layer contains no objects and the layer is not the active layer. WARNING: the undo-system of the document is cleared. Example
Dim Ls As Layers Dim L As Layer Ls.GetLayer "Buildings", L If Not (L Is Nothing) Then
Layers
Page 49-3
Ls.DeleteLayer L End If
DeleteEmptyLayers Parameters
None
Description Deletes all empty layers from the document. The active layer can not be deleted. WARNING: the undo-system of the document is cleared. Example
Dim Ls As Layers Ls.DeleteEmptyLayers
Layers
Page 49-4
Chapter 50 - LayerGroup
Description The LayerGroup object corresponds with a layer group in a Pythagoras drawing. See also the object type LayerGroups. Example
Dim Dim Dim Dim Dim Dim Dim A As Application Doc As Document LGs As LayerGroups LG As LayerGroup L As Layer i As Integer, j As Integer GroupNames() As String
Set A = New Application A.GetActiveDocument Doc If NOT Doc is nothing Then Doc.GetLayerGroups LGs If LGs.NrOfGroups > 0 Then ReDim GroupNames(1 To LGs.NrOfGroups) LGs.GetFirst LG For i = 1 To LGs.NrOfGroups GroupNames(i) = LG.Name For j = 1 To LG.NrOfLayers MsgBox "Group : " & LG.Name & " Next j LGs.GetNext LG Next I End If End if
Properties
Name NrOfLayers GetFirst GetNext SetProtected SetVisible SetSnappingDisabled SetMinimumAndMaximumScale AddLayer RemoveLayer
Methods
Properties
Name Returns
String
LayerGroup
Page 50-1
NrOfLayers Value
Long
Methods
GetFirst Parameters
L As Layer
GetNext Parameters
L As Layer
SetProtected Value
Protected As Boolean
Description Sets or resets the protection flag of all layers in the group. Example
Dim LG As LayerGroup LG.SetProtected True
SetVisible Value
Visible As Boolean
LayerGroup
Page 50-2
Description Sets or resets the visible flag of all layers in the group. Example
Dim LG As LayerGroup LG.SetVisible True
SetSnappingDisabled Value
SnappingDisabled As Boolean
Description Sets or resets the snapping disabled flag of all layers in the group. Example
Dim LG As LayerGroup LG.SetSnappingDisabled True
SetMinimumAndMaximumScale Parameters
MinimumScale As Double, MaximumScale As Double
Description Sets the minimum scale and maximum scale at which all layers of the group should be displayed. MinimumScale must be less then MaximumScale. MinimumScale = ptMinDouble if the layer has to be displayed at any scale up to MaximumScale. MaximumScale = ptMaxDouble if the layer has to be displayed starting from MinimumScale. Example
Dim LG As LayerGroup LG.SetMinimumAndMaximumScale 1/500.0, ptMaxDouble
AddLayer Parameters
L As Layer
RemoveLayer Parameters
L As Layer
LayerGroup
Page 50-3
Chapter 51 - LayerGroups
Description An instance of an object LayerGroups refers to all layer groups in a Pythagoras drawing. See also the object type LayerGroup. Example
See example LayerGroup
Properties Methods
Properties
NrOfGroups Value
Long
Methods
GetFirst Parameters
LG As LayerGroup
GetNext Parameters
L As Layer
LayerGroups
Page 51-1
MsgBox "First group = " & LG1.Name LGs.GetNext LG2 MsgBox "Second group = " & LG2.Name For a more elaborate example see the introduction on the object LayerGroup.
NewGroup Parameters
GroupName As String, LG As LayerGroup
Description Creates a new group with the name GroupName. On return, LG refers to the new group. Example
Dim LGs As LayerGroups Dim LG As LayerGroup LGs.NewGroup "Utilities", LG
DeleteGroup Parameters
LG As LayerGroup
SetActive Parameters
LG As LayerGroup
Description Sets the group LG active. This means that only layers of this group will show up in pop-up menus in the control panel and in dialog boxes. If LG = Nothing, no group will be active. Example
Dim LGs As LayerGroups Dim LG As LayerGroup LGs.SetActive LG
GetActive Parameters
LG As LayerGroup
Description Returns the active layer group. If LG = Nothing, no group is active. Example
Dim LGs As LayerGroups Dim LG As LayerGroup LGs.GetActive LG If LG Is Nothing Then MsgBox "No Layer Group is active" Else MsgBox LG.Name & " is the active Layer Group" End If
LayerGroups
Page 51-2
Chapter 52 - Symbol
Description The Symbol object is a generic object type that refers to either a PointSymbol, a LineSymbol, a Pattern or a SectionSymbol. These object types have a number of properties and methods common. See also the object types Symbols, PointSymbol, LineSymbol, Pattern, SectionSymbol, Symbols, SymbolGroups and Library. Be careful changing the symbol library. These operations can not be undone! Example
' This program enumerates all point symbols in the library. Dim A As Application Dim Lib As Library Dim Syms As Symbols Dim S As Symbol Dim Ps As PointSymbol Dim i As Long Dim AlwaysHorizontal As Boolean Set A = New Application A.GetSymbolLibrary Lib Lib.GetPointSymbols Syms If Not (Syms Is Nothing) Then Syms.GetFirstSymbol S For i = 1 To Syms.NrOfSymbols MsgBox "Group : " & S.Group & VBCRLF & "Item : " & S.Item If S.TypeOfSymbol = ptPointSymbol Then S.GetPointSymbol Ps AlwaysHorizontal = Not Ps.Rotatable End If Syms.GetNextSymbol S Next i End If
Properties
TypeOfSymbol Class Group Item FixedColor ScaleDependent CanBeRemoved GetDocument GetPointSymbol GetLineSymbol GetPattern GetSectionSymbol
Methods
Properties
TypeOfSymbol Returns
Integer
Description Returns the type of the symbol. The return value can be ptPointSymbol, ptLineSymbol, ptPattern or ptSectionSymbol. Example
Dim S As Symbol If S.TypeOfSymbol = ptPattern Then BlaBla
Symbol
Page 52-1
End If
Class Returns
Integer
Description Returns the class of the symbol. A symbol is either a Document or a Library symbol. The return value is either ptDocumentSymbol or ptLibrarySymbol. Example
Dim S As Symbol If S.Class = ptDocumentSymbolThen BlaBla End If
Group Returns
String
Description Returns or sets the name of the group to which of the symbol belongs. Example
Dim S As Symbol S.Group = "Buildings" ' Changes the group name part of the symbol name.
Item Returns
String
Description Returns or sets the item name (name within the group), of the symbol. Example
Dim S As Symbol S.Item = "House" ' Changes the 2nd part of the symbol name.
FixedColor Returns
Boolean
Description Returns True if the color of one or more of the elements of the symbol is fixed. This means that changing the color of an instance of this symbol has only effect on elements of the symbol without fixed color. Example
Dim S As Symbol Dim Pnt As Point If S.FixedColor = False Then Pnt.Color = ptBlue End If
ScaleDependent Returns
Boolean
Description Returns True if the size of the point symbol, the line style or the pattern will depend on the scale of the drawing. The property returns False if the symbol has a fixed size defined in paper dimensions.
Symbol
Page 52-2
Example
CanBeRemoved Returns
Boolean
Description Indicates if the symbol can be removed from the library. A symbol can not be removed if it is used in any open document. Example
Dim S As Symbol Dim Lib As Library If S.CanBeRemoved Then Lib.Remove S End If
Methods
GetDocument Parameters
Doc As Document
Description Returns the document object that contains the symbol. For a library symbol Doc = Nothing. Example
Dim Doc As Document Dim S As Symbol Dim Lib As Library S.GetDocument Doc If (Doc Is Nothing) And S.CanBeRemoved Then Lib.Remove S End If
GetPointSymbol Parameters
PntSymbol As PointSymbol
Description GetPointSymbol sets the reference to the symbol in a variable of type PointSymbol. Note that the reference is copied, not the symbol. Example
Dim S As Symbol Dim PntSymbol As PointSymbol S.GetPointSymbol PntSymbol
GetLineSymbol Parameters
LnSymbol As LineSymbol
Description GetLineSymbol sets the reference to the symbol in a variable of type LineSymbol. Note that the reference is copied, not the symbol itself.
Symbol
Page 52-3
Example
GetPattern Parameters
Pat As Pattern
Description GetPattern sets the reference to the symbol in a variable of type Pattern. Note that the reference is copied, not the symbol itself. Example
Dim S As Symbol Dim Pat As Pattern S.GetPattern Pat
GetSectionSymbol Parameters
S As SectionSymbol
Description GetSectionSymbol sets the reference to the symbol in a variable of type SectionSymbol. Note that the reference is copied, not the symbol itself. Example
Dim S As Symbol Dim Section As SectionSymbol S.GetSectionSymbol Section
Symbol
Page 52-4
Chapter 53 - PointSymbol
Description A PointSymbol is a Symbol. A point symbol can not be created, but a reference to an existing symbol can be obtained with the method GetPointSymbol. Example
Dim Dim Dim Dim Dim Dim Dim A As Application Lib As Library Syms As Symbols S As Symbol Ps As PointSymbol i As Long AlwaysHorizontal As Boolean
Set A = New Application A.GetSymbolLibrary Lib Lib.GetPointSymbols Syms If Not (Syms Is Nothing) Then Syms.GetFirstSymbol S For i = 1 To Syms.NrOfSymbols If S.TypeOfSymbol = ptPointSymbol Then S.GetPointSymbol Ps AlwaysHorizontal = Not Ps.Rotatable End If Syms.GetNextSymbol S Next i End If
Properties
TypeOfSymbol Class Group Item FixedColor ScaleDependent CanBeRemoved Rotatable Limits GetDocument
Methods
Properties
For a description of the properties TypeOfSymbol, Class, Group, Item, FixedColor, ScaleDependent, CanBeRemoved see object type Symbol. Rotatable Returns
Boolean
Limits Returns
ObliqueRectangle
PointSymbol
Page 53-1
Description Returns the enclosing rectangle of the symbol. The dimensions are relative to the hotspot of the symbol. The dimensions of a scale dependent symbol are real values (e.g. 1m. x 1m.), the dimensions of scale independent symbols are expressed in paper dimensions. (e.g. 3 mm. x 5 mm). Example
Dim R As ObliqueRectangle Dim S As PointSymbol R = S.Limits
Methods
For a description of the method GetDocument see object type Symbol.
PointSymbol
Page 53-2
Chapter 54 - LineSymbol
Description A LineSymbol is a Symbol. A line symbol can not be created, but a reference to an existing line style can be obtained with the method GetLineSymbol. Example
See PointSymbol TypeOfSymbol Class Group Item FixedColor ScaleDependent CanBeRemoved Width Length GetDocument
Properties
Methods
Properties
For a description of the properties TypeOfSymbol, Class, Group, Item, FixedColor, ScaleDependent, CanBeRemoved see object type Symbol. Width Returns
Double
Description Returns the maximum width of the line style. The width of a scale dependent line style is the real width (e.g. 0.5 m); the width of a scale independent line style is expressed in paper dimensions. (e.g. 3 mm.). Example
Dim S As LineSymbol Dim W As Double, L As Double W = S.Width L = S.Length
Length Returns
Double
Description Returns the length of a segment of the line style. The length of a scale dependent line style is the real length (e.g. 15.0 m), the length of a scale independent lines style is expressed in paper dimensions. (e.g. 5 mm.). Warning: some line styles have a Length = ptMaxDouble. Example
See Width
Methods
For a description of the method GetDocument see object type Symbol.
LineSymbol
Page 54-1
Chapter 55 - Pattern
Description A Pattern is a Symbol. A pattern can not be created, but a reference to an existing pattern can be obtained with the method GetPattern. Example
See PointSymbol TypeOfSymbol Class Group Item FixedColor ScaleDependent CanBeRemoved GetDocument
Properties
Methods
Properties
For a description of the properties TypeOfSymbol, Class, Group, Item, FixedColor, ScaleDependent, CanBeRemoved see object type Symbol.
Methods
For a description of the method GetDocument see object type Symbol.
Pattern
Page 55-1
Chapter 56 - SectionSymbol
Description A SectionSymbol is a Symbol that refers to a typical section used for road design. A SectionSymbol can not be created, but a reference to an existing typical section can be obtained with the method GetSectionSymbol. Example
See PointSymbol TypeOfSymbol Class Group Item FixedColor ScaleDependent CanBeRemoved GetDocument
Properties
Methods
Properties
For a description of the properties TypeOfSymbol, Class, Group, Item, FixedColor, ScaleDependent, CanBeRemoved see object type Symbol.
Methods
For a description of the method GetDocument see object type Symbol.
SectionSymbol
Page 56-1
Chapter 57 - SymbolGroup
Description The SymbolGroup object refers to the set of symbols of the same type (Pattern, Line Style, ...) and having the same group name. A SymbolGroup can be obtained from an object Symbols e.g. with the method GetGroup. Example
' This program enumerates all point symbols groups in the library. Dim A As Application Dim Lib As Library Dim Syms As Symbols Dim G As SymbolGroup Dim Ps As PointSymbol Dim i As Long Dim AlwaysHorizontal As Boolean Set A = New Application A.GetSymbolLibrary Lib Lib.GetPointSymbols Syms If Not (Syms Is Nothing) Then Syms.GetFirstGroup G For i = 1 To Syms.NrOfGroups MsgBox "Group : " & G.Group Syms.GetNextGroup G Next i End If
Properties
Methods
Properties
TypeOfSymbol Returns
Integer
Description Returns the type of the symbols in the group. The return value can be ptPointSymbol, ptLineSymbol, ptPattern or ptSectionSymbol . Example
Dim G As SymbolGroup If G.TypeOfSymbol = ptPattern Then BlaBla End If
Class Returns
Integer
Description Returns the class of the symbols in the group. The symbols of the group are either Document or Library symbols. The return value is either ptDocumentSymbol or ptLibrarySymbol.
SymbolGroup
Page 57-1
Example
Group Returns
String
NrOfSymbols Returns
Long
Methods
GetDocument Parameters
Doc As Document
Description If the group was obtained from a document symbol library, then this method returns the document object that contains the group. For a library symbol Doc = Nothing. Example
Dim Doc As Document Dim G As SymbolGroup G.GetDocument Doc
GetFirst Parameters
Sym As Symbol
SymbolGroup
Page 57-2
GetNext Parameters
Sym As Symbol
SymbolGroup
Page 57-3
Chapter 58 - Symbols
Description The Symbols object refers to the complete set of symbols of the same type in a document library or in the system library. A Symbols object can be obtained from the Library object with the methods GetPointSymbols, GetLineSymbols, GetPatterns and GetSectionSymbols. Example
' This program enumerates all point symbols in the library. Dim A As Application Dim Lib As Library Dim Syms As Symbols Dim G As Symbol Dim Ps As PointSymbol Dim i As Long Dim AlwaysHorizontal As Boolean Set A = New Application A.GetSymbolLibrary Lib Lib.GetPointSymbols Syms If Not (Syms Is Nothing) Then Syms.GetFirstSymbol G For i = 1 To Syms.NrOfSymbols Enumerate G a specific procedure to enumerate a symbol Syms.GetNextSymbol G Next i End If
Properties
TypeOfSymbol Class NrOfSymbols NrOfGroups GetDocument GetFirstSymbol GetNextSymbol GetSymbol GetFirstGroup GetNextGroup GetGroup RemoveAllUnusedSymbols
Methods
Properties
TypeOfSymbol Returns
Integer
Description Returns the type of the symbols in the set. The return value can be ptPointSymbol, ptLineSymbol, ptPattern or ptSectionSymbol . Example
Dim Syms As Symbols If Syms.TypeOfSymbol = ptPattern Then BlaBla End If
Class Returns
Integer
Symbols
Page 58-1
Description Returns the class of the symbols in the set. The symbols of the set are either Document or System Library symbols. The return value is either ptDocumentSymbol or ptLibrarySymbol. Example
Dim Syms As Symbols If Syms.Class = ptDocumentSymbolThen BlaBla End If
NrOfSymbols Returns
Long
NrOfGroups Returns
Long
Methods
GetDocument Parameters
Doc As Document
Description If the group was obtained from a document symbol library, then this method returns the document object that contains the group. For a library symbol Doc = Nothing. Example
Dim Doc As Document Dim Syms As Symbols Syms.GetDocument Doc
GetFirstSymbol Parameters
Sym As Symbol
Symbols
Page 58-2
GetNextSymbol Parameters
Sym As Symbol
GetSymbol Parameters
Group As String, Item As String, Sym As Symbol
Description GetSymbol returns the symbol with the given name. If the symbol is not found, Sym = Nothing is returned. Example
Dim Syms As Symbols Dim S As Symbol Syms.GetSymbol "Buildings", "Concrete", S
GetFirstGroup Parameters
G As SymbolGroup
GetNextGroup Parameters
G As SymbolGroup
GetGroup Parameters
GroupName As String, G As SymbolGroup
Description GetGroup returns the group with the name given by the parameter GroupName. If the group is not found, G = Nothing is returned. Example
Dim Syms As Symbols Dim G As SymbolGroup Syms.GetGroup "Buildings", G
Symbols
Page 58-3
RemoveAllUnusedSymbols Parameters Description RemoveAllUnusedSymbols removes all symbols of the set which are not used in the document. Example
Dim Syms As Symbols Syms.RemoveAllUnusedSymbols
Symbols
Page 58-4
Chapter 59 - Library
Description The Library object refers to the complete set of symbols of in a document or in the system library. A Library object can be obtained from the Document object with the method GetSymbolLibrary, or from the Application object with the method GetSymbolLibrary. Example
Dim A As Application Dim Lib As Library Dim PSymbols As Symbols, LSymbols As Symbols, _ HSymbols As Symbols, SSymbols As Symbols Set A = New Application A.GetSymbolLibrary Lib Lib.GetPointSymbols PSymbols Lib.GetLineSymbols LSymbols Lib.GetPatterns HSymbols Lib.GetSectionSymbols SSymbols
Properties Methods
Class GetDocument GetPointSymbols GetLineSymbols GetPatterns GetSectionSymbols Add Remove CreateSymbol RemoveAllUnusedSymbols
Properties
Class Returns
Integer
Description Returns the class of the symbols in the library. The symbols of the set are either Document or System Library symbols. The return value is either ptDocumentSymbol or ptLibrarySymbol. Example
Dim Lib As Library If Lib.Class = ptDocumentSymbolThen BlaBla End If
Methods
GetDocument Parameters
Doc As Document
Description This method returns the document object this library belongs to. For the system library (Class = ptLibrarySymbol) : Doc = Nothing. Example
Dim Doc As Document Dim Lib As Library
Library
Page 59-1
Lib.GetDocument Doc
GetPointSymbols Parameters
Syms As Symbols
Description GetPointSymbols returns the set of point symbols in the library. Example
Dim Syms As Symbols Dim Lib As Library Lib.GetPointSymbols Syms
GetLineSymbols Parameters
Syms As Symbols
Description GetLineSymbols returns the set of line styles in the library. Example
Dim Syms As Symbols Dim Lib As Library Lib.GetLineSymbols Syms
GetPatterns Parameters
Syms As Symbols
GetSectionSymbols Parameters
Syms As Symbols
Description GetSectionSymbols returns the set of section symbols in the library. Example
Dim Syms As Symbols Dim Lib As Library Lib.GetSectionSymbols Syms
Add Parameters
S As Symbol
Description The method Add moves a document symbol to the system library. Example
Dim S As Symbol Dim Lib As Library
Library
Page 59-2
Lib.Add S
Remove Parameters
S As Symbol
Description The method Remove removes a symbol from the library. If the symbol can not be removed because it is used in an open document, an error will be raised. WARNING: the undo-system of the document is cleared. Example
Dim S As Symbol Dim Lib As Library Lib.Remove S
CreateSymbol Parameters
Container As SymbolContainer, Group As String, Name As String, ScaleDependent As Boolean, Rotatable As Boolean, NorthSymbol As Boolean, NewSymbol As Symbol
Description This method creates theSymbol object from the argument SymbolContainer. ParametersGroup, Name, ScaleDependent, Rotatable, and NorthSymbol specify attributes of the symbol being created. If the argument ScaleDependent is True then all dimensions are considered as local dimensions, otherwise as paper dimensions. The generic symbol object NewSymbol referring to the created symbol is returned. If the symbol cant be created the value of Nothing is returned. All dimensions in SymbolContainer must be supplied in meters. Example
Dim Sym As Symbol Dim Lib As Library Dim Sc As SymbolContainer Lib.CreateSymbol Sc, "Samples", "SampleSym1", False, True, False, Sym
RemoveAllUnusedSymbols Parameters
None
Description RemoveAllUnusedSymbols removes all symbols of the set that are not used in the library. WARNING: the undo-system of the document is cleared. Example
Dim Lib As Library Lib.RemoveAllUnusedSymbols
Library
Page 59-3
Chapter 60 - SymbolContainer
Description A SymbolContainer object is a container object to collect the information about symbol elements. It is supposed that a symbol container will be used afterwards to create a symbol. Methods of SymbolContainer return True if success and False otherwise. Example See example for the Library method CreateSymbol. Methods AddLine AddColoredLine AddArc AddColoredArc AddCircle AddColoredCircle AddText AddColoredText AddPolygon AddColoredPolygon
Methods
AddLine Parameters Returns
P1 As XY, P2 As XY, Width As Double Boolean
Set Sc = New SymbolContainer p1.X = 1.0 p1.Y = 2.0 p2.X = 5.0 p2.Y = 6.0 Ok = Sc.AddLine(p1, p2, 1)
Description Adds a line with the specified color from point P1 to point P2. Example
Dim Dim Dim Dim Dim Sc As p1 As p2 As color Ok As SymbolContainer XY XY As RGB Boolean
SymbolContainer
Page 60-1
Set Sc = New SymbolContainer p1.X = 1.0 p1.Y = 2.0 p2.X = 5.0 p2.Y = 6.0 color.Red = 120 color.Green = 250 color.Blue = 65 Ok = Sc.AddColoredLine(p1, p2, 1, color)
AddArc Parameters
Center As XY, Radius As Double, Angle1 As Double, Angle2 As Double, Width As Double Boolean
Returns
Description Adds a non-colored arc with the specified center and radius from the angle Angle1 to the angle Angle2 counterclockwise. Example
Dim Sc As SymbolContainer Dim c As XY Dim Ok As Boolean Set Sc = New SymbolContainer c.X = 5.0 c.Y = 6.0 Ok = Sc.AddArc(c, 1, 1.5, 2.2, 0.2)
AddColoredArc Parameters
Center As XY, Radius As Double, Angle1 As Double, Angle2 As Double, Width As Double, color As RGB Boolean
Returns
Description Adds an arc with the specified center, radius, and color from the angle Angle1 to the angle Angle 2 counterclockwise. Example
Dim Dim Dim Dim Sc As SymbolContainer c As XY color As RGB Ok As Boolean
Set Sc = New SymbolContainer c.X = 5.0 c.Y = 6.0 color.Red = 0 color.Green = 255 color.Blue = 0 Ok = Sc.AddColoredArc(c, 1, 1.5, 2.2, 0.2, color)
SymbolContainer
Page 60-2
Description Adds a non-colored circle with the specified center and radius. Only the values ptNoFill, ptSolidFill, ptGrayxx (xx = 75, 50, 25 or 12) are valid for Filling. Example
Dim Sc As SymbolContainer Dim c As XY Set Sc = New SymbolContainer c.X = 5.0 c.Y = 6.0 Sc.AddCircle(c, 0.7, 1, ptSolidFill) color
AddColoredCircle Parameters
Center As XY, Radius As Double, Width As Double, Filling As Integer, color As RGB Boolean
Returns
Description Adds a non-colored circle with the specified center, radius, and color . Only the values ptNoFill, ptSolidFill, ptGrayxx (xx = 75, 50, 25 or 12) are valid for Filling. Example
Dim Dim Dim Dim Sc As SymbolContainer c As XY color As RGB Ok As Boolean
Set Sc = New SymbolContainer c.X = 5.0 c.Y = 6.0 color.Red = 0 color.Green = 0 color.Blue = 255 Ok = Sc.AddColoredCircle(c, 0.7, 1, ptGray25, color) Filled with 25% of blue
AddText Parameters
Position As XY, Text As String, Height As Double, Weight As Integer, Style As Integer Boolean
Returns
Description Adds a non-colored text with content Text at position Position. Value of Height must be specified in meters. Example
Dim Sc As SymbolContainer Dim p As XY Dim Ok As Boolean Set Sc = New SymbolContainer p.X = 5.0 p.Y = 6.0 Ok = Sc.AddText(p, "Just a text", 0.004, ptMedium, ptItalic)
AddColoredText Parameters
Position As XY, Text As String, Height As Double, Weight As Integer, Style As Integer , color As RGB
SymbolContainer
Page 60-3
Returns
Boolean
Description Adds text with content Text at position Position and with the specified color. Value of Height must be specified in meters. Example
Dim Dim Dim Dim Sc As SymbolContainer p As XY color As RGB Ok As Boolean
Set Sc = New SymbolContainer p.X = 5.0 p.Y = 6.0 color.Red = 255 color.Green = 0 color.Blue = 0 Ok = Sc.AddColoredText(p, "Just a text", 0.004, ptLight, ptUpright, color)
Description Adds a non-colored polygon.Polygon is composed ofstraight lines connecting adjacent points specified by the argument Points. . A polygon must be closed, this means the last point must end in the first one. If not, symbol container will add the missing end point. A polygon must be nonempty, so the minimal size of the points array is equal to 4.Only the values ptNoFill, ptSolidFill, ptGrayxx (xx = 75, 50, 25 or 12) are valid for Filling.Width is a value between 0.0 and 2.0. If the value = 0.0, the lines of the polygon will not become part of the symbol. In that case, the Filling must be different from ptNoFill. Example
Dim Sc As SymbolContainer Dim points() As XY Dim Ok As Boolean Set Sc = New SymbolContainer Redim points(1 To 4) Points(1).X = 5.0 Points(1).Y = 6.0 Points(2).X = 5.0 Points(2).Y = 8.0 Points(3).X = 8.0 Points(3).Y = 8.0 Points(4).X = 5.0 Points(4).Y = 6.0 Ok = Sc.AddPolygon(points, 0.7, ptGray25) color
Description Adds a non-colored polygon. Polygon is composed from straight lines connecting adjacent points specified by the argument Points. A polygon must be closed, this means the last point must end in the first one. If not, symbol container will add the missing end point. A polygon must be nonempty, so the minimal size of the points array is equal to 4.Only the values ptNoFill, ptSolidFill, ptGrayxx (xx = 75, 50,
SymbolContainer
Page 60-4
25 or 12) are valid for Filling.The lines of the polygon will have the same color as the filling.Width is a value between 0.0 and 2.0. If the value = 0.0, the lines of the polygon will not become part of the symbol. In that case, the Filling must be different from ptNoFill. Example
Dim Dim Dim Dim Sc As SymbolContainer points() As XY color As RGB Ok As Boolean
Set Sc = New SymbolContainer color.Red = 0 color.Green = 255 color.Blue = 0 Redim points(1 To 4) Points(1).X = 5.0 Points(1).Y = 6.0 Points(2).X = 5.0 Points(2).Y = 8.0 Points(3).X = 8.0 Points(3).Y = 8.0 Points(4).X = 5.0 Points(4).Y = 6.0 Ok = Sc.AddColoredPolygon(points, 0.7, ptGray25, color) green
SymbolContainer
Page 60-5
Chapter 61 - UserDefaults
Description A UserDefaults object contains the actual list of all user defaults that are accessible to the Pythagoras user. The UserDefaults object, and each UserDefault obtained using the methods GetFirst and GetNext, remain dynamically linked to the actual settings in Pythagoras. A deleted User Default in Pythagoras will make the corresponding VBA Object invalid. Example
Dim Dim Dim Dim Dim App As Application UDs As UserDefaults UD As UserDefault Attribs as AttributesSet i As Long
Set App = New Application App.GetUserDefaults UDs For i = 1 To UDs.NrUserDefaults If i = 1 Then UDs.GetFirst UD Else UDs.GetNext UD End If Set Attribs = UD.AttributesSet MsgBox UD.Name Next i
Properties Methods
Properties
NrUserDefaults Returns
Long
Methods
GetFirst Parameters
UD As UserDefault
UserDefaults
Page 61-1
Dim i As Long Set App = New Application App.GetUserDefaults UDs For i = 1 To UDs.NrUserDefaults If i = 1 Then UDs.GetFirst UD Else UDs.GetNext UD End If Next i
GetNext Parameters
UD As UserDefault
SetActive Parameters
UserDefault
Description This method sets the active user default in Pythagoras. Setting Active to Nothing, will set the active User Default in Pythagoras to None. Example
Dim Dim Dim Dim App As Application UDs As UserDefaults UD As UserDefault Attribs as AttributesSet
Set App = New Application App.GetUserDefaults UDs ' Get a UD that you want to set active UDs.SetActive UD
GetActive Parameters
UserDefault
Description This property returns the active user default in Pythagoras. The method returns Nothing if no UserDefault is active. Example
Dim Dim Dim Dim App As Application UDs As UserDefaults UD As UserDefault Attribs as AttributesSet
Set App = New Application App.GetUserDefaults UDs UDs.GetActive UD If Not UD Is Nothing Then Attribs = UD.AttributesSet End If
RemoveUserDefault Parameters
UD As UserDefault
UserDefaults
Page 61-2
Description The method RemoveUserDefault removes a user default. If the user default can not be removed, an error will be raised. Example
Dim UDs As UserDefaults Dim UD As UserDefault UDs.RemoveUserDefault UD
AddUserDefault Parameters
Attribs As AttributesSet, Group As String, Name As String, UD As UserDefault
Description The method AddUserDefaultadds a new user default. If a user default with the given name already exists, an error will be raised. The method returns a UserDefault object. Example
Dim UDs As UserDefaults Dim UD As UserDefault UDs.AddUserDefaultAttribs, Group, Name, UD
UserDefaults
Page 61-3
Chapter 62 - UserDefault
Description A UserDefault object contains all information of a user default. The UserDefault object obtained fromUserDefaultsremains dynamically linked to the actual settings in Pythagoras. A deleted User Default in Pythagoras will make the corresponding VBA Object invalid. Example
Dim Dim Dim Dim Dim Dim Dim App As Application UDs As UserDefaults UD As UserDefault Attribs as AttributesSet LayerName As String Group As String Name As String
Set App = New Application App.GetUserDefaults UDs UDs.GetActive UD If Not UD Is Nothing Then Attribs = UD.AttributesSet If Attribs.HasLayerName Then LayerName = Attribs.LayerName End If MsgBox "The user default " & Group & "," & Name & "uses layer: " LayerName End If
Properties
Methods
Properties
Group Returns
String
Description This property returns the Group the User Default belongs to. Example
Dim UD As UserDefault Dim Group As String Dim Name As String Group = UD.Group
Name Returns
String
Description This property returns the Name, within the group, of the User Default. Example
Dim UD As UserDefault Dim Name As String Name = UD.Name
UserDefault
Page 62-1
Active Returns
Boolean
Description Returns True if the User Default is active. When setting the User Default to True, the user default becomes the active one. Setting Active to False, will set the active User Default in Pythagoras to None. Example
Dim UD As UserDefault UD.Active = True
AttributesSet Returns
AttributesSet
Description Returns an AttributesSet whose settings correspond with the settings in the UserDefault. Example
Dim UD As UserDefault Dim Attribs As AttributesSet Set Attribs = UD.AttributesSet
Methods
GetFullName Parameters
Group As String, Name As String
Description Returns the Group and Name of the User Default Example
Dim UD As UserDefault Dim Group As String Dim Name As String UD.GetFullName Group, Name
UserDefault
Page 62-2
Chapter 63 - AttributesSet
Description The AttributesSet is a container for the 5 objects PointAttributes, LineAttributes, PolygonAttributes, TextAttributes,ImageAttributes, together with a common property for Color, Layer Name, Display Level and Comment. These common attributes apply to all object types unless the corresponding attribute is assigned to a specific object type. Example
Dim Dim Dim Dim Dim Dim Dim Dim Dim Dim Dim App as Application Doc as Document Ovl as Overlay All as AllObjects Attribs as AttributesSet Pattribs as PointAttributes Lattribs as LineAttributes PolyAttribs as PolygonAttributes TextAttribs as TextAttributes Iattribs as ImageAttributes Blue as RGB
Blue.Blue = 255 Set App = New Application App.GetActivedocument Doc Doc.GetOverlay ptDrawing, Ovl Ovl.GetAllObjects All Set Attribs = New AttributesSet Set Pattribs = Attribs.PointAttributes Set Lattribs = Attribs.LineAttributes Set PolyAttribs = Attribs.PolygonAttributes Set TextAttribs = Attribs.TextAttributes Set Iattribs = Attribs.ImageAttributes Attribs.TrueColor = Blue Attribs.HasColor = True Attribs.Layer = "Buildings" Attribs.HasLayer = True All.ApplyThematics Attribs
Properties
PointAttributes LineAttributes PolygonAttributes TextAttributes ImageAttributes TrueColor HasColor Layer HasLayer DisplayLevel HasDisplayLevel Comment HasComment PointConfirmation HasPointConfirmation Copy
Properties
PointAttributes Returns
PointAttributes
AttributesSet
Page 63-1
Description This property returns or sets the PointAttributes. If this is set to nothing, it will reset the PointAttributes to the default values. Example
Dim Attribs As AttributesSet Dim Pattribs As PointAttributes Set Pattribs = Attribs.PointAttributes Set Attribs.PointAttributes = Pattribs
LineAttributes Returns
LineAttributes
Description This property returns or sets the LineAttributes. If this is set to nothing, it will reset the LineAttributes to the default values. Example
Dim Attribs As AttributesSet Dim Lattribs As LineAttributes Set Lattribs = Attribs.LineAttributes Set Attribs.LineAttributes = Lattribs
PolygonAttributes Returns
PolygonAttributes
Description This property returns or sets the PolygonAttributes. If this is set to nothing, it will reset the PolygonAttributes to the default values. Example
Dim Attribs As AttributesSet Dim Polyattribs As PolygonAttributes Set Polyattribs = Attribs.PolygonAttributes Set Attribs.PolygonAttributes = PolyAttribs
TextAttributes Returns
TextAttributes
Description This property returns or sets the TextAttributes. If this is set to nothing, it will reset the TextAttributes to the default values. Example
Dim Attribs As AttributesSet Dim TextAttribs As TextAttributes Set TextAttribs = Attribs.TextAttributes Set Attribs.TextAttributes = TextAttribs
ImageAttributes Returns
ImageAttributes
Description This property returns or sets the ImageAttributes. If this is set to nothing, it will reset the ImageAttributes to the default values.
AttributesSet
Page 63-2
Example
Dim Attribs As AttributesSet Dim Iattribs As ImageAttributes Set Iattribs = Attribs.ImageAttributes Set Attribs.ImageAttributes = Iattribs
TrueColor Returns
RGB
Description This property returns or sets the color (RGB) of the AttributesSet. Example
Dim Attribs As AttributesSet Dim Red as RGB Red.Red = 255 Set Attribs = New AttributesSet Attribs.TrueColor = Red
HasColor Returns
Boolean
Description This property returns or sets a boolean that enables or disables the color of the AttributesSet. Example
Dim Attribs As AttributesSet Dim Red as RGB Red.Red = 255 Set Attribs = New AttributesSet Attribs.TrueColor = Red Attribs.HasColor = True
Layer Returns
String
Description This property returns or sets the Layer of the AttributesSet. Example
Dim Attribs As AttributesSet Set Attribs = New AttributesSet Attribs.Layer = "Buildings"
HasLayer Returns
Boolean
Description This property returns or sets a boolean that enables or disables the layer of the AttributesSet. Example
Dim Attribs As AttributesSet Dim Layer As String Set Attribs = New AttributesSet Attribs.Layer = Layer Attribs.HasLayer = True
AttributesSet
Page 63-3
DisplayLevel Returns
Integer
Description This property returns or sets the display level of the AttributesSet. Example
Dim Attribs As AttributesSet Set Attribs = New AttributesSet Attribs.DisplayLevel = -5 Attribs.HasDisplayLevel = True
HasDisplayLevel Returns
Boolean
Description This property returns or sets a boolean that enables or disables the display level of the AttributesSet. Example
Dim Attribs As AttributesSet Dim Red as RGB Set Attribs = New AttributesSet Attribs.HasDisplayLevel = False
Comment Returns
String
Description This property returns or sets the comment (object information) of the AttributesSet. Example
Dim Attribs As AttributesSet Set Attribs = New AttributesSet Attribs.Comment = "DH" Attribs.HasComment = True
HasComment Returns
Boolean
Description This property returns or sets a boolean that enables or disables the comment of the AttributesSet. Example
Dim Attribs As AttributesSet Set Attribs = New AttributesSet Attribs.HasComment = False
PointConfirmation Returns
Boolean
AttributesSet
Page 63-4
Attribs.PointConfirmation = False
HasPointConfirmation Returns
Boolean
Description This property returns or sets a boolean that enables or disables that coordinates/distances/... have to be confirmed. Example
Dim Attribs As AttributesSet Set Attribs = New AttributesSet Attribs.PointConfirmation = False Attribs.HasPointConfirmation = True
Copy Returns
Attribs as AttributesSet
AttributesSet
Page 63-5
Chapter 64 - PointAttributes
Description PointAttributes is a collection of visual attributes for point objects, with an option to enable or disable each attribute. It can be a part of AttributesSet, but works individualy as well. Example
Dim Attribs as AttributesSet Dim Pattribs as PointAttributes Set Attribs = New AttributesSet Set Pattribs = Attribs.PointAttributes
Properties
PointStyle HasStyle TrueColor HasColor Layer HasLayer DisplayLevel HasDisplayLevel Comment HasComment PointIdent HasPointIdent ZoomFactor HasZoomFactor HasScaleFactor Copy GetScaleFactor SetScaleFactor
Methods
Properties
PointStyle Returns
Style
HasStyle Returns
Boolean
Description This property returns or sets a boolean that enables or disables the style of PointAttributes. Example
Dim Pattribs As PointAttributes Dim Pstyle as Style Set Pattribs = New PointAttributes Pattribs.HasStyle = True Pattribs.PointStyle = Pstyle
PointAttributes
Page 64-1
TrueColor Returns
RGB
Description This property returns or sets the color (RGB) of PointAttributes. Example
Dim Pattribs As PointAttributes Dim Red as RGB Red.Red = 255 Set Pattribs = New PointAttributes Pattribs.TrueColor = Red
HasColor Returns
Boolean
Description This property returns or sets a boolean that enables or disables the color of PointAttributes. Example
Dim Pattribs As PointAttributes Dim Red as RGB Red.Red = 255 Set Pattribs = New PointAttributes Pattribs.TrueColor = Red Pattribs.HasColor = TRUE
Layer Returns
String
HasLayer Returns
Boolean
Description This property returns or sets a boolean that enables or disables the layer of PointAttributes. Example
Dim Pattribs As PointAttributes Set PAttribs = New PointAttributes Pattribs.Layer = "Buildings" Pattribs.HasLayer = True
DisplayLevel Returns
Integer
Description This property returns or sets the display level of the PointAttributes.
PointAttributes
Page 64-2
Example
Dim Pattribs As PointAttributes Set PAttribs = New PointAttributes Pattribs.DisplayLevel = -5 Pattribs.HasDisplayLevel = True
HasDisplayLevel Returns
Boolean
Description This property returns or sets a boolean that enables or disables the display level of the PointAttributes. Example
Dim Pattribs As PointAttributes Set PAttribs = New PointAttributes Pattribs.HasDisplayLevel = False
Comment Returns
String
Description This property returns or sets the comment (object information) of the PointAttributes. Example
Dim Pattribs As PointAttributes Set PAttribs = New PointAttributes Pattribs.Comment = "DH" Pattribs.HasComment = True
HasComment Returns
Boolean
Description This property returns or sets a boolean that enables or disables the comment of the PointAttributes. Example
Dim Pattribs As PointAttributes Set PAttribs = New PointAttributes Pattribs.HasComment = False
PointIdent Returns
Boolean
Description This property returns or sets the indication if a new created point will get the next point number or no point number. Example
Dim Pattribs As PointAttributes Set Pattribs = New PointAttributes Pattribs.PointIdent = False
HasPointIdent Returns
Boolean
PointAttributes
Page 64-3
Description This property returns or sets a boolean that enables or disables thethe PointIdent of PointAttributes. Example
Dim Pattribs As PointAttributes Set Pattribs = New PointAttributes Pattribs.PointIdent = False Pattribs.HasPointIdent = True
ZoomFactor Returns
Double
HasZoomFactor Returns
Boolean
Description This property returns or sets a boolean that enables or disables the zoomfactor of PointAttributes. Example
Dim Pattribs As PointAttributes Set Pattribs = New PointAttributes Pattribs.ZoomFactor = 0.6 Pattribs.HasZoomFactor = TRUE
HasScaleFactor Returns
Boolean
Description This property returns or sets a boolean that enables or disables the ScaleFactor of PointAttributes. Example
Dim Pattribs As PointAttributes Set Pattribs = New PointAttributes Pattribs.SetScaleFactor 0.5, 0.5 Pattribs.HasScaleFactor = TRUE
Copy Returns
PointAttributes
PointAttributes
Page 64-4
Methods
GetScaleFactor Parameters
ScaleX As Double, ScaleY As Double
Description GetScaleFactor returns both the factors (X and Y) by which the symbol is scaled. The scale factors are expressed in %. One or both scale factors may be negative. Example
Dim Pattribs As PointAttributes Dim ScaleX as Double, ScaleY as Double Set Pattribs = New PointAttributes GetScaleFactor ScaleX, ScaleY
SetScaleFactor Parameters
ScaleX As Double, ScaleY As Double
Description SetScaleFactor sets the scale factors(X and Y) of the PointAttributes. Example
Dim Pattribs As PointAttributes Set Pattribs = New PointAttributes SetScaleFactor -100.0, 100.0
PointAttributes
Page 64-5
Chapter 65 - LineAttributes
Description LineAttributes is a collection of visual attributes for line objects, with an option to enable or disable each attribute. It can be a part of AttributesSet, but works individualy as well. Example
Dim Attribs as AttributesSet Dim Lattribs as LineAttributes Set Attribs = New AttributesSet Set Lattribs = Attribs.LineAttributes
Properties
LineStyle HasStyle TrueColor HasColor Layer HasLayer DisplayLevel HasDisplayLevel Comment HasComment HiddenEndPoints HasHiddenEndPoints Arrows HasArrows Width HasWidth Scale HasScale Copy
Properties
LineStyle Returns
Style
HasStyle Returns
Boolean
Description This property returns or sets a boolean that enables or disables the Style of LineAttributes. Example
Dim Lattribs As LineAttributes Dim Lstyle as Style Set Lattribs = New LineAttributes Lattribs.LineStyle = Lstyle Lattribs.HasStyle = TRUE
LineAttributes
Page 65-1
TrueColor Returns
RGB
Description This property returns or sets the color (RGB) of LineAttributes. Example
Dim Lattribs As LineAttributes Dim Red as RGB Red.Red = 255 Set Lattribs = New LineAttributes Lattribs.TrueColor = Red
HasColor Returns
Boolean
Description This property returns or sets a boolean that enables or disables the color of LineAttributes. Example
Dim Lattribs As LineAttributes Dim Red as RGB Red.Red = 255 Set Lattribs = New LineAttributes Lattribs.TrueColor = Red Lattribs.HasColor = TRUE
Layer Returns
String
HasLayer Returns
Boolean
Description This property returns or sets a boolean that enables or disables the layer of LineAttributes. Example
Dim Lattribs As LineAttributes Set Lattribs = New LineAttributes Lattribs.Layer = "Buildings" Lattribs.HasLayer = True
DisplayLevel Returns
Integer
Description This property returns or sets the display level of the LineAttributes.
LineAttributes
Page 65-2
Example
Dim Lattribs As LineAttributes Set Lattribs = New LineAttributes Lattribs.DisplayLevel = -5 Lattribs.HasDisplayLevel = True
HasDisplayLevel Returns
Boolean
Description This property returns or sets a boolean that enables or disables the display level of the LineAttributes. Example
Dim Lattribs As LineAttributes Set Lattribs = New LineAttributes Lattribs.HasDisplayLevel = False
Comment Returns
String
Description This property returns or sets the comment (object information) of the LineAttributes. Example
Dim Lattribs As LineAttributes Set Lattribs = New LineAttributes Lattribs.Comment = "DH" Lattribs.HasComment = True
HasComment Returns
Boolean
Description This property returns or sets a boolean that enables or disables the comment of the LineAttributes. Example
Dim Lattribs As LineAttributes Set Lattribs = New LineAttributes Lattribs.HasComment = False
HiddenEndPoints Returns
Boolean
Description This property returns or sets a boolean that indicates if the style of the end points of new lines that don't refer to existing points will be hidden. In other words, if the PointStyle of those points will be = ptHiddenPoint. Example
Dim Lattribs As LineAttributes Set Lattribs = New LineAttributes Lattribs.HiddenEndPoints = True
LineAttributes
Page 65-3
HasHiddenEndPoints Returns
Boolean
Description This property returns or sets a boolean that enables or disables the HiddenEndpointsproperty inLineAttributes. Example
Dim Lattribs As LineAttributes Set Lattribs = New LineAttributes Lattribs.HasComment = False
Arrows Returns
Integer
Description This property returns or sets a value of LineAttributes indicating which ends of a line has arrows. The arrows parameter has the following valid values : ptNoArrows, ptArrowP1, ptArrowP2, ptArrowP1P2. Example
Dim Lattribs As LineAttributes Set Lattribs = New LineAttributes Lattribs.Arrows = ptArrowP1P2
HasArrows Returns
Boolean
Description This property returns or sets a boolean that enables or disables arrows in LineAttributes Example
Dim Lattribs As LineAttributes Set Lattribs = New LineAttributes Lattribs.Arrows = ptArrowP1P2 Lattribs.HasArrows = TRUE
Width Returns
Double
Description This property sets or returns the Width of the LineAttributes. The line width must be between 0.1 (0.01 mm) and 25.5 (2.55 mm). Example
Dim Lattribs As LineAttributes Set Lattribs = New LineAttributes Lattribs.Width = 5.0
HasWidth Returns
Boolean
Description This property sets or returns the boolean that enables or disables the width of LineAttributes.
LineAttributes
Page 65-4
Example
Dim Lattribs As LineAttributes Set Lattribs = New LineAttributes Lattribs.Width = 5.0 Lattribs.HasWidth = TRUE
Scale Returns
Double
Description This property sets or returns the scale of LineAttributes. Scaling is only applicable to scalable line styles. Example
Dim Lattributes As LineAttributes Set Lattributes = New LineAttributes Lattributes.Scale = 120.0
HasScale Returns
Boolean
Description This property sets or returns the boolean that enables or disables the scale of LineAttributes. Example
Dim Lattributes As LineAttributes Set Lattributes = New LineAttributes Lattributes.Scale = 120.0 Lattributes.HasScale = TRUE
Copy Returns
LineAttributes
LineAttributes
Page 65-5
Chapter 66 - PolygonAttributes
Description PolygonAttributes is a collection of visual attributes for polygon objects, with an option to enable or disable each attribute. It can be a part of AttributesSet, but works individualy as well. Example
Dim Attribs as AttributesSet Dim PolyAttribs as PolygonAttributes Set Attribs = New AttributesSet Set PolyAttribs = Attribs.PolygonAttributes
Properties
Pattern HasPattern Border HasBorder TrueColor HasColor Layer HasLayer DisplayLevel HasDisplayLevel Comment HasComment BGPattern HasBGPattern Scale HasScale BGColor Opaque HasOpaque Copy
Properties
Pattern Returns
Style
HasPattern Returns
Boolean
Description This property returns or sets a boolean that enables or disables the pattern of PolygonAttributes. Example
Dim PolyAttribs As PolygonAttributes Dim PolyStyle as Style Set Polyattribs = New PolygonAttributes Polyattribs.Pattern = PolyStyle PolyAttribs.HasPattern = TRUE
PolygonAttributes
Page 66-1
Border Returns
Integer
Description This property returns or sets the border of PolygonAttributes. ptNoBorder = The polygon is filled / will be filled normal (not only a border). ptBorder1mm .. ptBorder10mm = The width of the border of the polygon is / will be from 1 mm up to 10 mm depending on the value of the parameter. ptBorder1mmOpen .. ptBorder10mmOpen = The width of the border of the polygons is / will be from 1 mm up to 10 mm depending on the value of the parameter. The last leg of the polygon is left open. Example
Dim PolyAttribs As PolygonAttributes Set PolyAttribs = New PolygonAttributes PolyAttribs.Border = ptBorder3mm
HasBorder Returns
Boolean
Description This property returns or sets a boolean that enables or disables the border of PolygonAttributes. Example
Dim PolyAttribs As PolygonAttributes Set PolyAttribs = New PolygonAttributes PolyAttribs.Border = ptBorder3mm PolyAttribs.HasBorder = TRUE
TrueColor Returns
RGB
Description This property returns or sets the color (RGB) of PolygonAttributes. Example
Dim PolyAttribs As PolygonAttributes Dim Red as RGB Red.Red = 255 Set PolyAttribs = New PolygonAttributes PolyAttribs.TrueColor = Red
HasColor Returns
Boolean
Description This property returns or sets a boolean that enables or disables the color of PolygonAttributes. Example
Dim PolyAttribs As PolygonAttributes Dim Red as RGB Red.Red = 255 Set PolyAttribs = New PolygonAttributes PolyAttribs.TrueColor = Red PolyAttribs.HasColor = TRUE
PolygonAttributes
Page 66-2
Layer Returns
String
HasLayer Returns
Boolean
Description This property returns or sets a boolean that enables or disables the layer of PolygonAttributes. Example
Dim PolyAttribs As PolygonAttributes Set PolyAttribs = New PolygonAttributes PolyAttribs.Layer = "Buildings" PolyAttribs.HasLayer = True
DisplayLevel Returns
Integer
Description This property returns or sets the display level of the PolygonAttributes. Example
Dim PolyAttribs As PolygonAttributes Set PolyAttribs = New PolygonAttributes PolyAttribs.DisplayLevel = -5 PolyAttribs.HasDisplayLevel = True
HasDisplayLevel Returns
Boolean
Description This property returns or sets a boolean that enables or disables the display level of the PolygonAttributes. Example
Dim PolyAttribs As PolygonAttributes Set PolyAttribs = New PolygonAttributes PolyAttribs.HasDisplayLevel = False
Comment Returns
String
Description This property returns or sets the comment (object information) of thePolygonAttributes. Example
Dim PolyAttribs As PolygonAttributes
PolygonAttributes
Page 66-3
HasComment Returns
Boolean
Description This property returns or sets a boolean that enables or disables the comment of the PolygonAttributes. Example
Dim PolyAttribs As PolygonAttributes Set PolyAttribs = New PolygonAttributes PolyAttribs.HasComment = False
BGPattern Returns
Style
Description This property returns or sets the background pattern of PolygonAttributes. Example
Dim PolyAttribs As PolygonAttributes Dim PolyStyle as Style Set PolyAttribs = New PolygonAttributes PolyAttribs.BGPattern = PolyStyle
BGColor Returns
RGB
Description This property returns or sets the background color (RGB) of PolygonAttributes. Example
Dim PolyAttribs As PolygonAttributes Dim Red as RGB Red.Red = 255 Set PolyAttribs = New PolygonAttributes PolyAttribs.BGColor = Red
HasBGPattern Returns
Boolean
Description This property returns or sets a boolean that enables or disables the background patternand background color of PolygonAttributes. Example
Dim PolyAttribs As PolygonAttributes Dim PolyStyle as Style Set PolyAttribs = New PolygonAttributes PolyAttribs.BGPattern = PolyStyle PolyAttribs.HasBGPattern = TRUE
PolygonAttributes
Page 66-4
Scale Returns
Double
Description Sets or returns the scale of PolygonAttributes. The scale is expressed in %. Example
Dim PolyAttribs As PolygonAttributes Set PolyAttribs = New PolygonAttributes Polyattribs.Scale = 150.0
HasScale Returns
Boolean
Description This property sets or returns the boolean that enables or disables the scale of PolygonAttributes. Example
Dim PolyAttribs As PolygonAttributes Set PolyAttribs = New PolygonAttributes PolyAttribs.Scale = 150.0 PolyAttribs.HasScale = TRUE
Opaque Returns
Boolean
HasOpaque Returns
Boolean
Description Sets or returns a boolean that enables or disables the attribute Opaque of the PolygonAttributes. Example
Dim PolyAttribs As PolygonAttributes Set PolyAttribs = New AttributesSet PolyAttribs.Opaque = TRUE PolyAttribs.HasOpaque = TRUE
Copy Returns
PolygonAttributes
PolygonAttributes
Page 66-5
PolygonAttributes
Page 66-6
Chapter 67 - TextAttributes
Description TextAttributes is a collection of visual attributes for point objects, with an option to enable or disable each attribute. It can be a part of AttributesSet, but works individualy as well. Example
Dim Attribs as AttributesSet Dim TAttribs as TextAttributes Set Attribs = New AttributesSet Set TAttribs = Attribs.TextAttributes
Properties
Content Style HasStyle PointSize HasPointSize Underline HasUnderline Border HasBorder Weight HasWeight LineSpacing HasLineSpacing HorizontalAlignment HasHorizontalAlignment VerticalAlignment HasVerticalAlignment Orientation HasOrientation Opaque HasOpaque TrueColor HasColor Layer HasLayer DisplayLevel HasDisplayLevel Copy GetFont SetFont
Methods
Properties
Content Returns
String
Description This property sets or returns the content of the text. The content may be an empty string. Example
Dim TAttribs As TextAttributes TAttribs.Content = "Cable 4x10"
Style Returns
Integer
TextAttributes
Page 67-1
Description This property returns or sets the style of the text in the TextAttributes. Style = ptUpright : Normal Style = ptItalic : Italic Example
Dim TAttribs As TextAttributes Dim Style as Integer Set TAttribs = New TextAttributes TAttribs.Style = ptItalic
HasStyle Returns
Boolean
Description This property returns or sets a boolean that enables or disables the style of the text inTextAttributes. Example
Dim TAttribs As TextAttributes Dim Tstyle as Style Set TAttribs = New TextAttributes TAttribs.Style = ptItalic TAttribs.HasStyle = True
PointSize Returns
Integer
Description This property sets or returns the point size of the text.Value of PointSize must be between 1 and 1000. Example
Dim TAttribs As TextAttributes TAttribs.PointSize = 20
HasPointSize Returns
Boolean
Description This property returns or sets a boolean that enables or disables the pointsize property of the text. Example
Dim TAttribs As TextAttributes Set TAttribs = New TextAttributes TAttribs.PointSize = 20 TAttribs.HasPointSize = TRUE
Underline Returns
Integer
Description This property sets or returns the underlining of the text. Underline = ptUnderlineNone : no underlining. Underline = ptUnderlineSingle : single underlining. Underline = ptUnderlineDouble : double underlining. Underline = ptUnderlineDashed : underlining dashed line.
TextAttributes
Page 67-2
Example
HasUnderline Returns
Boolean
Description This property returns or sets a boolean that enables or disables the Underline property of the text. Example
Dim TAttribs As TextAttributes TAttribs.Underline = ptUnderlineNone TAttribs.HasUnderline = True
Border Returns
Integer
Description This property sets or returns the border of the text. Border = ptBorderNone : no border. Border = ptBorderSingle : single border. Border = ptBorderDouble : double border. Example
Dim TAttribs As TextAttributes TAttribs.Border = ptBorderSingle
HasBorder Returns
Boolean
Description This property returns or sets a boolean that enables or disables the Border property of the text. Example
Dim TAttribs As TextAttributes TAttribs.Border = ptBorderSingle TAttribs.HasBorder = True
Weight Returns
Integer
Description This property sets or returns the weight of the text. Weight = ptLight : Light Weight = ptMedium : Normal Weight = ptBold : Bold Weight = ptExtraBold : Extra Bold Not all fonts can be represented Light or Extra Bold. Example
Dim TAttribs As TextAttributes TAttribs.Weight = ptBold
TextAttributes
Page 67-3
HasWeight Returns
Boolean
Description This property returns or sets a boolean that enables or disables the Weight property of the text. Example
Dim TAttribs As TextAttributes TAttribs.Weight = ptBold TAttribs.HasWeight = True
LineSpacing Returns
Integer
Description This property sets or returns the line spacing of the text. LineSpacing = ptSpacingSmall : small line spacing. LineSpacing = ptSpacingNormal : normal line spacing. LineSpacing = ptSpacingLarge : large line spacing. Example
Dim TAttribs As TextAttributes TAttribs.LineSpacing = ptSpacingNormal
HasLineSpacing Returns
Boolean
Description This property returns or sets a boolean that enables or disables the LineSpacing property of the text. Example
Dim TAttribs As TextAttributes TAttribs.LineSpacing = ptSpacingNormal TAttribs.HasLineSpacing = True
HorizontalAlignment Returns
Integer
Description This property sets or returns the horizontal alignment of the text. Alignment = ptAlignLeft : left aligned. Alignment = ptAlignCenter : centered. Alignment = ptAlignRight : right aligned. Example
Dim TAttribs As TextAttributes TAttribs.HorizontalAlignment = ptAlignRight
HasHorizontalAlignment Returns
Boolean
Description This property returns or sets a boolean that enables or disables the HorizontalAlignment property of the text.
TextAttributes
Page 67-4
Example
VerticalAlignment Returns
Integer
Description This property sets or returns the vertical alignment of the text. Alignment = ptAlignBottom: bottom aligned. Alignment = ptAlignCenter : centered. Alignment = ptAlignTop : top aligned. Example
Dim TAttribs As TextAttributes TAttribs.VerticalAlignment = ptAlignCenter TAttribs.HasVerticalAlignment = True
HasVerticalAlignment Returns
Boolean
Description This property returns or sets a boolean that enables or disables the VerticalAlignment property of the text. Example
Dim TAttribs As TextAttributes TAttribs.VerticalAlignment = ptAlignBottom TAttribs.HasVerticalAlignment = True
Orientation Returns
Integer
Description This property sets or returns the orientation of the text. Orientation = ptTextHorizontal: The text will always appear horizontal independent of page orientation or angle. Orientation = ptTextOrientationReadable : The angle of the displayed or printed texts will change if the text would come upside down. If the angle of the texts is in 2nd or 3rd quadrant, the texts are turned over 180 degrees. Orientation = ptTextOrientationAbsolute : The texts are always displayed at the given angle. Example
Dim TAttribs As TextAttributes TAttribs.Orientation = ptTextHorizontal TAttribs.HasOrientation = True
HasOrientation Returns
Boolean
Description This property returns or sets a boolean that enables or disables the Underline property of the text. Example
Dim TAttribs As TextAttributes
TextAttributes
Page 67-5
Opaque Returns
Integer
Description This property sets or returns the transparency of the text. If = True : Opaque False : Transparant Example
Dim TAttribs As TextAttributes TAttribs.Opaque = False
HasOpaque Returns
Boolean
Description This property returns or sets a boolean that enables or disables the Opaque property of the text. Example
Dim TAttribs As TextAttributes TAttribs.Opaque = False TAttribs.HasOpaque = True
TrueColor Returns
RGB
Description This property returns or sets the color (RGB) of TextAttributes. Example
Dim TAttribs As TextAttributes Dim Red as RGB Red.Red = 255 Set TAttribs = New TextAttributes TAttribs.TrueColor = Red
HasColor Returns
Boolean
Description This property returns or sets a boolean that enables or disables the color of TextAttributes. Example
Dim TAttribs As TextAttributes Dim Red as RGB Red.Red = 255 Set TAttribs = New TextAttributes TAttribs.TrueColor = Red TAttribs.HasColor = True
Layer Returns
String
TextAttributes
Page 67-6
HasLayer Returns
Boolean
Description This property returns or sets a boolean that enables or disables the layer of TextAttributes. Example
Dim TAttribs As TextAttributes Set TAttribs = New TextAttributes TAttribs.Layer = "Buildings" TAttribs.HasLayer = True
DisplayLevel Returns
Integer
Description This property returns or sets the display level of the TextAttributes. Example
Dim TAttribs As TextAttributes Set TAttribs = New TextAttributes TAttribs.DisplayLevel = -5 TAttribs.HasDisplayLevel = True
HasDisplayLevel Returns
Boolean
Description This property returns or sets a boolean that enables or disables the display level of the TextAttributes. Example
Dim TAttribs As TextAttributes Set TAttribs = New TextAttributes TAttribs.HasDisplayLevel = False
Copy Returns
TextAttributes
TextAttributes
Page 67-7
Methods
GetFont Parameters
FontName As String, CodePage As Integer
Description GetFont returns the Font name and de codepage of the text in TextAttributes. Example
Dim TAttribs As TextAttributes Dim FontName As String Dim CodePage As Integer TAttribs.GetFont FontName, CodePage
SetFont Parameters
FontName As String, CodePage As Integer
Description SetFont sets the Font name and de codepage of the text. Example
Dim TAttribs As TextAttributes TAttribs.SetFont "Arial", ptWestern
TextAttributes
Page 67-8
Chapter 68 - ImageAttributes
Description ImageAttributes is a collection of visual attributes for Images, with an option to enable or disable each attribute. It can be a part of AttributesSet, but works individualy as well. Example
Dim Attribs as AttributesSet Dim Iattribs as ImageAttributes Set Attribs = New AttributesSet Set Iattribs = Attribs.ImageAttributes
Properties
Properties
TrueColor Returns
RGB
Description This property returns or sets the color (RGB) of ImageAttributes. Example
Dim Iattribs As ImageAttributes Dim Red as RGB Red.Red = 255 Set Iattribs = New ImageAttributes Iattribs.TrueColor = Red
HasColor Returns
Boolean
Description This property returns or sets a boolean that enables or disables the color of ImageAttributes. Example
Dim Iattribs As ImageAttributes Dim Red as RGB Red.Red = 255 Set Iattribs = New ImageAttributes Iattribs.TrueColor = Red Iattribs.HasColor = TRUE
Layer Returns
String
ImageAttributes
Page 68-1
Example
HasLayer Returns
Boolean
Description This property returns or sets a boolean that enables or disables the layer of ImageAttributes. Example
Dim IAttribs As ImageAttributes Set IAttribs = New ImageAttributes IAttribs.Layer = "Buildings" IAttribs.HasLayer = True
DisplayLevel Returns
Integer
Description This property returns or sets the display level of the ImageAttributes. Example
Dim IAttribs As ImageAttributes Set IAttribs = New ImageAttributes IAttribs.DisplayLevel = -5 IAttribs.HasDisplayLevel = True
HasDisplayLevel Returns
Boolean
Description This property returns or sets a boolean that enables or disables the display level of the ImageAttributes. Example
Dim IAttribs As ImageAttributes Set IAttribs = New ImageAttributes IAttribs.HasDisplayLevel = False
Comment Returns
String
Description This property returns or sets the comment (object information) of theImageAttributes. Example
Dim IAttribs As ImageAttributes Set IAttribs = New ImageAttributes IAttribs.Comment = "DH" IAttribs.HasComment = True
HasComment Returns
Boolean
ImageAttributes
Page 68-2
Description This property returns or sets a boolean that enables or disables the comment of the ImageAttributes. Example
Dim IAttribs As ImageAttributes Set IAttribs = New ImageAttributes IAttribs.HasComment = False
Copy Returns
ImageAttributes
ImageAttributes
Page 68-3
Chapter 69 - Stack
Description A Stack is a well known data type (LIFO). The Stack may mix variants of the following subtypes: Integer, Long, Single, Double, String, Date Example
Dim S As Stack Dim V As Variant Set S = New Stack S.Push 5.0 S.Push "Value : " ' ... MsgBox S.Pop() & CStr(S.Pop())
Properties Methods
Properties
NrOfItems Returns
Long
Description This property returns the number of items on the stack. Example
Dim S As Stack Set S = New Stack S.Push "Item 1" MsgBox CStr(S.NrOfItems)
Methods
Push Parameters
Value As Variant
Description This method will push the value on the stack. The stack may contains variants of different subtypes. Example
Dim S As Stack Dim V As Variant Set S = New Stack S.Push 1.25 V = "This is a string" S.Push V
Description This method will pop the value from the stack.
Stack
Page 69-1
Example
Clear Description This method will remove all items from the stack. Example
Dim S As Stack S.Clear
Stack
Page 69-2
Chapter 70 - Queue
Description A Queueis a well known data type (FIFO). The Queue may mix variants of the following subtypes: Integer, Long, Single, Double, String, Date. Example
Dim Q As Queue Set Q = New Queue Q.PutItem 5.0 Q.PutItem " m" ' ... MsgBox CStr(S.GetItem()) & Q.GetItem()
Properties Methods
Properties
NrOfItems Returns
Long
Description This property returns the number of items in the queue. Example
Dim Q As Queue Set Q = New Queue Q.PutItem "Item 1" MsgBox CStr(Q.NrOfItems)
Methods
PutItem Parameters
Value As Variant
Description This method will put the value on the queue. The queue may contain variants of different subtypes. Example
Dim Q As Queue Dim V As Variant Set Q = New Queue Q.PutItem 1.25 V = "This is a string" Q.PutItem V
Description This method will get the first value from the queue.
Queue
Page 70-1
Example
Clear Description This method will remove all items from the queue. Example
Dim Q As Queue Q.Clear
Queue
Page 70-2
Chapter 71 - Tree
Description A Treeis the well known data structure binary tree. The elements of the tree are of type ValueIndex, a record with the first field (Value) being a Variant and the second field (Index) a Long (see chapter: Pythagoras Data Types). The field Value contains the key, while the Index may be used to point to data that is related to the key. The pair (Value, Index) must be unique. So even if you don't need an index, and you want duplicate values in the tree, you will need to make Index unique for identical Values. The subtypes of Value may be numeric (mix of variants of the following subtypes: Integer, Long, Single andDouble),String, Date, orBoolean. All elements of the tree should have the same type (numeric, String, Date or Boolean). Example
Dim T As Tree Dim V As ValueIndex Set T = New Tree V.Value = "Fred" T.Insert V V.Value = "Annie" T.Insert V '... V = T.GetFirst("Annie") V = T.GetNext
Properties Methods
Properties
NrOfItems Returns
Long
Description This property returns the number of items in the Tree. Example
Dim T As Tree Dim Count As Long Count = T.NrOfItems
Methods
Insert Parameters
Value As ValueIndex
Tree
Page 71-1
Description This method will insert the data in the tree. The data will be sorted by value in the Value field of ValueIndex. The first value inserted in the tree defines the sub type. Types may not be mixed. If mixed, an error will be raised. Duplicate keys are allowed. However the combination Value, Index must be unique. Example
Dim T As Tree Dim Data As ValueIndex Set T = New Tree Data.Value = "Pythagoras" Data.Index = 1 T.Insert Data
Delete Parameters
Data As ValueIndex
Description This method will delete the data from the tree. If the data is not found, an error will be raised. Example
Dim T As Tree Dim Data As ValueIndex Set T = New Tree T.Insert Data T.Delete Data
Clear Description This method removes all items from the Tree. Example
Dim T As Tree T.Clear
GetFirst Parameters
Key As Variant Data As ValueIndex
Return Parameter
Description This method will get the first element from the tree with value >= Key. If the data is not found Null value is returned in the Value part of ValueIndex. Example
Dim T As Tree Dim Data As ValueIndex Dim Key As Variant Set T = New Tree T.Insert Data Data = T.GetFirst(Key)
Tree
Page 71-2
Description This method will get the next element from the tree. If no more data, Null value is returned in the Value part of ValueIndex. Example
Dim T As Tree Dim Data As ValueIndex
Set T = New Tree 'Insert data Data = T.GetFirst("Jozefien") '.... Data = T.GetNext
Tree
Page 71-3
Chapter 72 - Window
Description The Window object corresponds with the window of a Pythagoras document. Example
Dim A As Application Dim Doc As Document Dim W As Window Set A = New Application A.GetActiveDocument Doc Doc.GetWindow W W.Maximize
Properties
HasHorScrollBar HasVertScrollBar Width Height Position ScreenPosition HorScrollThumb VertScrollThumb Minimize Maximize Restore SetWindowSize
Methods
Properties
HasHorScrollBar Returns
Boolean
HasVertScrollBar Returns
Boolean
Width Returns
Long
Window
Page 72-1
Height Returns
Long
Position Returns
WindowCoord
Description Returns or sets the position of the window relative to the frame window of Pythagoras. Example
Dim Dim Dim Dim A D W P As As As As Application Document Window WindowCoord
set A = New Application A.GetActiveDocument D If NOT D is nothing Then D.GetWindow W p = W.Position MsgBox "Position : " & str(P.x) & " , " & str(P.y) P.x = P.x + 24 P.y = P.y - 30 W.Position = P W.SetWindowSize W.Width\2, W.Height\2 end if
ScreenPosition Returns
WindowCoord
Description Returns the position of the window relative to the top left position of the screen. Example
Dim Dim Dim Dim A D W P As As As As Application Document Window WindowCoord
Window
Page 72-2
MsgBox "Position : " & str(P.x) & " , " & str(P.y) end if
HorScrollThumb Returns
Integer
Description Returns or sets the position of the thumbs in the horizontal scroll bar. This value must be between 0 and 100. When reading HorScrollThumb, the value can differ from the value that has been set by 1 unit. Example
Dim W As Window If W.HasHorScrollBar Then W.HorScrollThumb = 50 If W.HorScrollThumb <> 50 Then ' This may happen. Value should be between 49 and 51 End If End If
VertScrollThumb Returns
Integer
Description Returns or sets the position of the thumbs in the vertical scroll bar. This value must be between 0 and 100. When reading VerScrollThumb, the value can differ from the value that has been set by 1 unit. Example
Dim W As Window If W.HasVertScrollBar Then W.VertScrollThumb = 50 End If
Methods
Minimize Parameters
None
Description Minimizes the window. On Windows, this method will behave identically as if the operation was done by clicking on the minimize control of the window. On Macintosh computers, the window will be reduced to a small rectangle. Example
Dim W As Window W.Minimize
Maximize Parameters
None
Description Maximizes the window. On Windows and Macintosh, this method will behave identically as if the operation was done by clicking on the maximize control of the window. Example
Dim W As Window W.Maximize
Window
Page 72-3
Restore Parameters
None
SetWindowSize Parameters
Horizontal As Long, Vertical As Long
Description Sets the size of the window. The size is expressed in pixels. Example
Dim W As Window W.SetWindowSize 500, 300
Window
Page 72-4
Chapter 73 - PathElement
Description A PathElement object is a generic object type that encompasses the element types PathLine, PathArc and PathClothoid. In contrast to CadObject objects, PathElement objects are intended only to represent elements of a road center line in a convenient manner. The PathElement object is two dimensional. When the type of a PathElementis known, the PathElementcan be converted to its specific element type. The properties Line, Arc and Clothoid return the object of a specific type. Example See example for the Road method GetCenterLine. Properties
ElementType Sequence Length BeginPoint EndPoint Line Arc Clothoid
Properties
ElementType Returns
Long
Description This property returns the specific type of the element. Valid return values : ptLine, ptArc, ptClothoid. Example
Dim Elem As PathElement Dim L As PathLine If Elem.ElementType = ptLine Then L = Elem.Line End If
Sequence Returns
Long
Description This property returns the path sequence of begin and end points of the element. Valid return values : ptP1P2, ptP2P1. Example
Dim Elem As PathElement Dim Seq As Long Dim S As String If Elem.ElementType = ptArc Then If Elem.Sequence = ptP1P2 Then S = "forward" Else S = "backward" End If MsgBox "Arc in "& S &" direction" End If
PathElement
Page 73-1
Length Returns
Double
Description This property returns the length of the path element. Example
Dim Elem As PathElement If Elem.Length > 100.0 Then . . . End If
BeginPoint Returns
XY
Description This property returns the first point of the path element. Example
Dim Elem As PathElement Dim P1 As XY P1 = Elem.BeginPoint
EndPoint Returns
XY
Description This property returns the second point of the path element. Example
Dim Elem As PathElement Dim P1 As XY P1 = Elem.EndPoint
Line Returns
PathLine
Description Returns the reference to the PathLine object, if this object has the type ptLine, otherwise returns Nothing. Example
Dim I As PathElement Dim L As PathLine Set L = I.Line
Arc Returns
PathArc
Description Returns the reference to the PathArc object, if this object has the type ptArc, otherwise returns Nothing. Example
Dim E As PathElement Dim A As PathArc
PathElement
Page 73-2
Set A = E.Arc
Clothoid Returns
PathClothoid
Description Returns the reference to the PathClothoid object, if this object has the type ptClothoid, otherwise returns Nothing. Example
Dim E As PathElement Dim C As PathClothoid Set C = E.Clothoid
PathElement
Page 73-3
Chapter 74 - PathLine
Description A PathLine is a PathElement. A new PathLine object can be created with the PathElement property Line. Example
Dim P As PathElement Dim PL As PathLine ... If P.ElementType = ptLine Then Set PL = P.Line MsgBox "Begin point is ("& CStr(PL.BeginPoint.x) & _ ","& CStr(PL.BeginPoint.y) &")" End If
Properties
Properties
For a description of the properties Sequence, Length, BeginPoint, EndPoint see object type PathElement.
PathLine
Page 74-1
Chapter 75 - PathArc
Description A PathArc is a PathElement. A new PathArc object can be created with the PathElement property Arc. Example
Dim P As PathElement Dim PA As PathArc ... If P.ElementType = ptArc Then Set PA = P.Arc MsgBox "Center is ("& CStr(PA.Center.x) & _ ","& CStr(PA.Center.y) &")" End If
Properties
Properties
For a description of the properties Sequence, Length, BeginPoint, EndPoint see object type PathElement. Radius Returns
Double
Description This property returns the radius of the arc in radians. Example
Dim MyArc As PathArc Dim Radius As Double Radius = MyArc.Radius
Center Returns
XY
Description This property returns the coordinate of the center of the arc. Example
Dim MyArc As PathArc Dim C As XY C = MyArc.Center
PathArc
Page 75-1
Chapter 76 - PathClothoid
Description A PathClothoid is a PathElement. A new PathClothoid object can be created with the PathElement property Clothoid. Example
Dim P As PathElement Dim PC As PathClothoid ... If P.ElementType = ptClothoid Then Set PC = P.Clothoid MsgBox "Center is ("& CStr(PC.Center.x) & _ ","& CStr(PC.Center.y) &")" End If
Properties
Properties
For a description of the properties Sequence, Length, BeginPoint, EndPoint see object type PathElement. ClothoidConstant Returns
Double
Description This property returns the rate of change of curvature also called the K-factor of the spiral curve (clothoid). Example
Dim PC As PathClothoid Dim K As Double K = PC.ClothoidConstant
StartRadius Returns
Double
Description This property returns the radius at the starting point of the clothoid. If the radius is infinite, ptMaxDouble is returned. Example
Dim PC As PathClothoid Dim Radius1 As Double, Radius2 As Double Radius1 = PC.StartRadius Radius2 = PC.EndRadius
PathClothoid
Page 76-1
EndRadius Returns
Double
Description This property returns the radius at the end point of the clothoid. If the radius is infinite, ptMaxDouble is returned. Example
Dim PC As PathClothoid Dim Radius1 As Double, Radius2 As Double Radius1 = PC.StartRadius Radius2 = PC.EndRadius
StartCenter Returns
XY
Description This property returns the coordinate of the center of the clothoid at the starting point. Example
Dim PC As PathClothoid Dim Center1 As XY, Center2 As XY Center1 = PC.StartCenter Center2 = PC.EndCenter
EndCenter Returns
XY
Description This property returns the coordinate of the center of the clothoid at the end point . Example
Dim PC As PathClothoid Dim Center1 As XY, Center2 As XY Center1 = PC.StartCenter Center2 = PC.EndCenter
Mirror Returns
Boolean
Description This property returns the direction of the clothoid. If False the clothoid is in counter-clockwise direction (P1 - P2). If True clockwise. Example
Dim PC As PathClothoid Dim Direction As Boolean Direction = PC.Mirror
PathClothoid
Page 76-2
Chapter 77 - GeoMath
Description A GeoMath object is a collection of properties and methods that allow: (1) to get information about geometric objects, (2) do calculations with geometric objects and (3) get relations between them. Example
Dim GM As GeoMath Set GM = New GeoMath
Methods
Distance, dS dZ Projection Intersection NewPoint NewLine NewArc NewCircle NewPolygon NewCurve NewClothoid
Methods
Distance (or dS) Parameters Returns
O1 As GeoObject, O2 As GeoObject Double
Description This method returns the 2D distance between two GeoObjects (as if the objects have Z = 0.0). - Points: distance between both points. - Point and Line: the perpendicular distance between the Point and the Line. The line is considered to have indefinate length. - Point and Arc: the distance between Point and Arc is the same as between Point and Circle with same center and radius. - Point and Circle: if the Point is outside the circle, the distance is positive, if inside, the distance is negative. - Point and Polygon: if the Point is outside the polygon, the distance is positive, if inside, the distance is negative. If the polygon contains holes and the point is in a hole, the point is outside, and as a consequence is positive - Point and Curve: the closest distance to the Curve. If there is no projection on the Curve, the distance is the closest distance to start or end vertex of the Curve. - Line and Line: is zero if lines are not parallel, else the distance between both lines. - Line and Arc: the distance between Line and Arc is the same as between Line and Circle with same center and radius. - Line and Circle: is zero if line and circle intersect, else the shortest distance between the line and the circle. - Line and Polygon: if the line intersects the polygon, the distance is zero, else it is the shortest distance of a polygon vertex and the Line. - Arc and Arc: same as Circle - Circle - Arc and Circle: same as Circle - Circle - Circle and Circle: is zero if both circles intersect. If one circle lies in the other, the distance is negative. - Arc and Polygon: same as Circle - Polygon - Circle and Polygon: if the circle intersects the polygon, the distance is zero, else the it is the shortest distance between the circle and the polygon. If the circle is inside the polygon, or the polygon lies in the circle, the distance is negative. - Polygon and Polygon: the shortest distance between both polygons. If both polygons intersect the distance is zero. If one polygon is inside the other, the distance is negative.
GeoMath
Page 77-1
dZ
Description This method returns the difference in height between two GeoObjects. The value is always positive. - Points: height difference between both points. - Point and Line / Arc / Circle: height difference between point and its projection point (see method Projection). - Point and Curve / Polygon: zero if Curve or Polygon are not horizontal. Else the difference in height. - Line and Line: if parallel 2D (not 3D): zero, if both lines are parallel (3D): the difference in height, else the dZ of the points on the line that have the same XY as the intersection. - Line and Arc: the dZ between Line and Arc is the same as between Line and Circle with same center and radius. - Line and Circle: is zero if line is not horizontal or has same elevation as circle. If line is horizontal, the difference in height. - Line and Polygon: the difference in height if both Line and Polygon are horizontal. Else zero. - Arc / Circle / Polygon / Curve and Arc / Circle / Polygon / Curve: difference in height if objects are horizontal. Else zero. All other combinations result in an exception. Example
Dim GM As GeoMath Dim O1 As GeoObject, O2 As GeoObject Dim dZ As Double dZ = GM.dZ(O1, O2)
Description This method returns the coordinates of the projection of a point on an object. Example
Dim Dim Dim Dim GM As GeoMath O1 as GeoObject, O2 as GeoObject OnObject As Boolean Pnt As XYZ
Description This method returns the intersections of two objects. If both objects don't intersect NrOfPoints will be zero GeoMath
Page 77-2
Example
Description This method creates a GeoArc. If the arc is not horizontal, the object is spatially an ellipse. In plane view the object is an arc. Meaning of parameters: C: center of the arc, Pnt1: starting point of the arc. The radius = Distance(C, Pnt1). Pnt2: end point of the arc. If Distance(C, Pnt2) <>radius, internally Pnt2 will be adapted. The arc is counter-clockwise from Pnt1-Pnt2. The elevation of the arc is defined by the elevation of points Pnt1 and Pnt2 and taking into account that the object spatially is an ellipse.
GeoMath
Page 77-3
Example
Dim GM As GeoMath Dim A As GeoArc Dim C As XYZ, Pnt1 As XYZ, Pnt2 As XYZ Set A = GM.NewArc(C, Pnt1, Pnt2)
Description This method creates a GeoCircle. If the circle is not horizontal, the object is spatially an ellipse. In plane view the object is a circle. C: center of the circle, Pnt: point on the circle, Example
Dim GM As GeoMath Dim C As GeoCircle Dim Center As XYZ, Pnt As XYZ Set C = GM.NewCircle(C, Pnt)
Description This method creates a GeoCircle. If the circle is not horizontal, the object is spatially an ellipse. In plane view the object is a circle. Pnt1: first point on the circle, Pnt2: second point on the circle, Pnt3: third point on the circle Example
Dim GM As GeoMath Dim C As GeoCircle Dim Pnt1 As XYZ, Pnt2 As XYZ, Pnt3 As XYZ Set C = GM.NewCircle3P(Pnt1, Pnt2, Pnt3)
Description This method creates a GeoPolygon. The number of points in the polygon is defined by the dimension ofPnts. The minimum dimension is 3 (triangle). The first point and the last point of the polygon may be the same. In this case the polygon will be considered as having one point less. Example
Dim GM As GeoMath Dim Poly As GeoPolygon Dim Pnts() As XYZ
GeoMath
Page 77-4
Description This method creates a GeoCurve. The number of points of the Curve is defined by the dimension ofPnts. Example
Dim GM As GeoMath Dim S As GeoCurve Dim Pnts() As XYZ Set S = GM.NewCurve(Pnts)
NewClothoid Parameters
P1 As XYZ, P2 As XYZ, RStart As Double, REnd As Double, K As Double, Mirror As Boolean GeoClothoid
Returns
Description This method creates a GeoClothoid. P1 : Starting point P2 : End point RStart : Radius at starting point REnd : Radius at end point K : K-Factor of the clothoid Mirror : If False the clothoid is in counter-clockwise direction (P1 - P2). If True clockwise. If the radius of the starting or end point is infinite, the value ptMaxDouble must be passed. Note : The parameters must be specified very accurately. If the resulting clothoid can not be calculated, run-time error 1056 will be generated. Example
Dim GM As GeoMath Dim Cl As GeoClothoid Dim P1 As XYZ, P2 As XYZ P1.x = P1.y = P1.z = P2.x = P2.y = P2.z = Set Cl 0.0 0.0 0.0 63.348 6.777 0.0 = GM.NewClothoid P1, P2, ptMaxDouble, 100.0, 80.0, False
GeoMath
Page 77-5
Chapter 78 - GeoObject
Description A GeoObjectis a generic object type that encompasses the object types PointObject, LineObject, ArcObject, CircleObject, CurveObject, ClothoidObject, and PolygonObject. Properties
Horizontal Z ObjectType GetPoint GetLine GetArc GetCircle GetClothoid GetCurve GetPolygon Copy
Methods
(Incorrectly implemented)
Properties
Horizontal Returns
Boolean
Description This property returnsTrue if all points of the GeoObject have the same elevation. This property returns always true for a point. Example
Dim GM As GeoMath Dim O1 As GeoObject, O2 As GeoObject Dim Dz As Double If O1.Horizontal And O2.Horizontal Then Dz = O1.Z - O2.Z End If
Z Returns
Double
Description This method returns the height of an horizontal object. If the object is not horizontal, the method raises an exception. Example
Dim GM As GeoMath Dim O As GeoObject Dim Z As Double Z = O.Z
ObjectType Returns
Integer
GeoObject
Page 78-1
Description This property returns the specific type of the GeoObject. Valid return values : ptPoint, ptLine, ptArc, ptCircle, ptCurve, ptPolygon, ptClothoid . Example
Dim GM As GeoMath Dim O As GeoObject If O.Type = ptLine Then End If
Methods
GeObjects can not be assigned to objects of a specific type. So the statement : Set P = Obj is not valid. Instead, the statements GetPoint, GetLine, etc. need to be used. GetPoint Parameters
P As GeoPoint
Description GetPoint sets the reference to the object in a variable of type GeoPoint. Note that the reference is copied, not the object. Example
Dim Obj As GeoObject Dim P As GeoPoint Obj.GetPoint P ' Same as : Set P = Obj
GetLine Parameters
L As GeoLine
Description GetLine sets the reference to the object in a variable of type GeoLine. Note that the reference is copied, not the object. Example
Dim Obj As GeoObject Dim L As GeoLine Obj.GetLine L ' Same as : Set L = Obj
GetArc Parameters
A As GeoArc
Description GetArc sets the reference to the object in a variable of type GeoArc. Note that the reference is copied, not the object. Example
Dim Obj As GeoObject Dim A As GeoArc Obj.GetArc A ' Same as : Set A = Obj
GetCircle Parameters
C As GeoCircle
GeoObject
Page 78-2
Description GetCircle sets the reference to the object in a variable of type GeoCircle. Note that the reference is copied, not the object. Example
Dim Obj As GeoObject Dim C As GeoCircle Obj.GetCircle C ' Same as : Set C = Obj
GetClothoid Parameters
C As GeoClothoid
Description GetClothoid sets the reference to the object in a variable of type GeoClothoid. Note that the reference is copied, not the object. Example
Dim Obj As GeoObject Dim C As GeoClothoid Obj.GetClothoid C ' Same as : Set c = Obj
GetCurve Parameters
A As Curve
Description GetCurve sets the reference to the object in a variable of type GeoCurve. Note that the reference is copied, not the object. Example
Dim Obj As GeoObject Dim C As GeoCurve Obj.GetCurve C ' Same as : Set C = Obj
GetPolygon Parameters
P As GeoPolygon
Description GetPolygon sets the reference to the object in a variable of type GeoPolygon. Note that the reference is copied, not the object. Example
Dim Obj As GeoObject Dim P As GeoPolygon Obj.GetPolygon P ' Same as : Set P = Obj
Copy Parameters
None
(Incorrectly implemented)
Returns
NewObj As GeoObject
GeoObject
Page 78-3
Set O2 = O1.Copy()
GeoObject
Page 78-4
Chapter 79 - GeoPoint
Description A GeoPoint is a GeoObject. A new GeoPoint can be created with the GeoMath method NewPoint or simple by using Set GP = New GeoPoint Example
Dim GM As GeoMath Dim PntObj As GeoPoint Dim Pnt As XYZ Set GM = New Pnt.x = 10.0 Pnt.y = 5.0 Pnt.z = 1.0 Set PntObj = ' or Set PntObj = PntObj.XYZ = GeoMath
Properties
XYZ XY X Y Z
Methods
GetGeoObject
Properties
XYZ Returns
XYZ
Description This property sets or returns the 3D coordinates of the point object . Example
Dim P As GeoPoint Dim Pnt As XYZ Pnt = P.XYZ
XY Returns
XY
Description This property sets or returns the 2D coordinates of the point object. Example
Dim P As GeoPoint Dim Pnt As XY Pnt = P.XY
X Returns
Double
Description This property sets or returns the X coordinate of the point object .
GeoPoint
Page 79-1
Example
Y Returns
Double
Description This property sets or returns the Y coordinate of the point object . Example
Dim P As GeoPoint P.X = 10.0
Z Returns
Double
Description This property sets or returns the Z coordinate of the point object . Example
Dim P As GeoPoint P.Z = 2.5
Methods
GetGeoObject Parameters Returns
PO As GeoPoint GeoObject
Description GetGeoObject sets the reference to the GeoPoint in a variable of type GeoObject. Note that the reference is copied, not the object. Example
Dim Obj As GeoObject Dim P As GeoPoint Set Obj = P.GetGeoObject() ' Same as : Set Obj = P
GeoPoint
Page 79-2
Chapter 80 - GeoLine
Description A GeoLine is a GeoObject. A new GeoLine can be created with the GeoMath method NewLine or simple by using Set GP = New GeoLine Example
Dim GM As GeoMath Dim LineObj As GeoLine Dim Pnt1 As XYZ, Pnt2 As XYZ Set GM = New GeoMath Pnt1.x = 10.0 Pnt1.y = 5.0 Pnt1.z = 1.0 Pnt2 = Pnt1 Pnt2.x = 20.0 Set LineObj = GM.NewLine(Pnt1, Pnt2) ' or Set LineObj = New GeoLine LineObj. = Pnt
Properties
Horizontal Z P1 P2 GetGeoObject
Methods
Properties
For a description of the properties Horizontal, Zsee object type GeoObject. P1 and P2 Returns
XYZ
Description These properties set or return the coordinates of the line . Example
Dim L As GeoLine Dim P1 As XYZ, P2 As XYZ P1 = L.P1 L.P2 = P2
Methods
GetGeoObject Parameters Returns
Line As GeoLine GeoObject
Description GetGeoObject sets the reference to the GeoLine in a variable of type GeoObject. Note that the reference is copied, not the object. Example
Dim Obj As GeoObject Dim L As GeoLine
GeoLine
Page 80-1
GeoLine
Page 80-2
Chapter 81 - GeoArc
Description A GeoArc is a GeoObject. A new GeoArc can be created with the GeoMath method NewArc or simple by using Set GA = New GeoArc. If the elevation of Pnt1 and Pnt are not equal, the arc is part of an ellipse (spatially). The projection in the X-Y plane is a circular arc. The elevation of the arc is defined by the plane of the ellipse. The elevation of the center does not affect the elevation of the arc. Example
Dim GM As GeoMath Dim ArcObj As GeoArc Dim C As XYZ, Pnt1 As XYZ, Pnt2 As XYZ Set GM = New GeoMath Pnt1.x = 10.0 Pnt1.y = 0.0 Pnt1.z = 0.0 Pnt2 = Pnt1 Pnt2.x = 0.0 Pnt2.y = 10.0 Set ArcObj = GM.NewArc(C, Pnt1, Pnt2) ' or Set ArcObj = New GeoArc ArcObj.C = C ArcObj.P1 = Pnt1 ArcObj.P2 = Pnt2
Properties
Horizontal Z C P1 P2 GetGeoObject
Methods
Properties
For a description of the properties Horizontal, Zsee object type GeoObject. C Returns
XYZ
Description This property sets or returns the center of the arc . Example
Dim A As GeoArc Dim C As XYZ C = A.C
P1 Returns
XYZ
Description This property sets or returns the starting point of the arc . Example
Dim A As GeoArc Dim P1 As XYZ, P2 As XYZ
GeoArc
Page 81-1
P1 = A.P1 A.P2 = P2
P2 Returns
XYZ
Description This property sets or returns the end point of the arc . Example
See P1
Radius Returns
Double
Description This property returns the radius (2D) of the arc . Example
Dim A As GeoArc Dim R As Double R = A.Radius
Methods
GetGeoObject Parameters Returns
PO As GeoArc GeoObject
Description GetGeoObject sets the reference to the GeoPoint in a variable of type GeoObject. Note that the reference is copied, not the object. Example
Dim Obj As GeoObject Dim A As GeoArc Set Obj = A.GetGeoObject() ' Same as : Set Obj = A
GeoArc
Page 81-2
Chapter 82 - GeoCircle
Description A GeoCircle is a GeoObject. A new GeoCircle is created with the GeoMath method NewCircle or simple by using Set GC = New GeoCircle. A GeoCircle is defined by its center and a second point. If the elevation of C and P are not equal, the object is an ellipse (spatially). The projection in the X-Y plane is a circle. The elevation of the circle is defined by the plane of the ellipse. Example
Dim GM As GeoMath Dim CircleObj As GeoCircle Dim C As XYZ, C As XYZ, Pnt As XYZ Set GM = New GeoMath C.x = 0.0 C.y = 0.0 C.z = 0.0 Pnt = C Pnt.y = 10.0 Set CircleObj = GM.NewCircle(C, Pnt) ' or Set CircleObj = New GeoCircle CircleObj.C = C CircleObj.P = Pnt
Properties
Horizontal Z C P GetGeoObject
Methods
Properties
For a description of the properties Horizontal, Zsee object type GeoObject. C Returns
XYZ
Description This property sets or returns the center of the circle . Example
Dim Circle As GeoCircle Dim C As XYZ C = Circle.C
P Returns
XYZ
Description This property sets or returns the radius point of the circle . Example
Dim Circle As GeoCircle Dim P As XYZ P = Circle.P
GeoCircle
Page 82-1
Radius Returns
Double
Description This property returns the radius (2D) of the circle . Example
Dim Circle As GeoCircle Dim R As Double R = Circle.Radius
Methods
GetGeoObject Parameters Returns
PO As GeoArc GeoObject
Description GetGeoObject sets the reference to the GeoPoint in a variable of type GeoObject. Note that the reference is copied, not the object. Example
Dim Obj As GeoObject Dim C As GeoCircle Set Obj = C.GetGeoObject() ' Same as : Set Obj = C
GeoCircle
Page 82-2
Chapter 83 - GeoClothoid
Description A GeoClothoid is a GeoObject. A new GeoClothoid is created with the GeoMath method NewClothoid or simple by using Set GC = New GeoClothoid. Example
Dim Dim Dim Dim GM As GeoMath ClothoidObj As GeoClothoid P1 As XYZ, P2 As XYZ, R1 As Double, R2 As Double, K As Double Mirror As Boolean, Fi As Double
Set GM = New GeoMath P1.x = 0.0 P1.y = 0.0 P1.z = 0.0 P2.x = 100.0 P2.y = 100.0 P2.z = 0.0 R1 = ptMaxDouble R2 = 1000.0 K = 50 Mirror = True Fi = TBD Set ClothoidObj = GM.NewClothoid(P1, P2, R1, R2, K, Mirror, Fi)
Properties
Methods
Properties
For a description of the properties Horizontal, Zsee object type GeoObject. P1 Returns
XYZ
Description This property returns the starting point of the Clothoid . Example
Dim Cl As GeoClothoid Dim P1 As XYZ P1 = Cl.P1
P2 Returns
XYZ
GeoClothoid
Page 83-1
Example
R1 Returns
Double
Description This property returns the radius at the starting point (P1) of the clothoid. If the radius is infinite, ptMaxDouble is returned. Example
Dim Cl As GeoClothoid Dim R1 As Double R1 = Cl.R1
R2 Returns
Double
Description This property returns the radius at the end point (P2) of the Clothoid . If the radius is infinite, ptMaxDouble is returned. Example
Dim Cl As GeoClothoid Dim R2 As Double R2 = Cl.R2
K Returns
Double
Description This property returns the rate of change of curvature also called the K-factor of the spiral curve (clothoid). Example
Dim Cl As GeoClothoid Cl.K = 50.0
Mirror Returns
Boolean
Description This property returns the direction of the clothoid. If False the clothoid is in counter-clockwise direction (P1 - P2). If True clockwise. Example
Dim Cl As GeoClothoid Dim Direction As Boolean Direction = Cl.Mirror
GeoClothoid
Page 83-2
Methods
GetGeoObject Parameters Returns
PO As GeoArc GeoObject
Description GetGeoObject sets the reference to the GeoPoint in a variable of type GeoObject. Note that the reference is copied, not the object. Example
Dim Obj As GeoObject Dim C As GeoClothoid Set Obj = C.GetGeoObject() ' Same as : Set Obj = C
GeoClothoid
Page 83-3
Chapter 84 - GeoCurve
Description A GeoCurve is a GeoObject. A new GeoCurve is created with the GeoMath method NewCurve or simple by using Set GC = New GeoCurve. Example
Dim GM As GeoMath Dim CurveObj As GeoCurve Set GM = New GeoMath Redim Pnts(1 To 3) ' Init Pnts Set CurveObj = GM.NewCurve(Pnts) ' or Set CurveObj = New GeoCurve CurveObj.SetPoints Pnts
Properties
Methods
Properties
For a description of the properties Horizontal, Zsee object type GeoObject. NrOfPoints Returns
Long
Description This property returns the number of point of the Polygon . Example
Dim A As GeoPolygon Dim C As XYZ C = A.C
Methods
SetPoints Parameters
Pnts() As XYZ
GeoCurve
Page 84-1
GetPoints Parameters
Pnts() As XYZ
Description GetGeoObject sets the reference to the GeoCurve in a variable of type GeoObject. Note that the reference is copied, not the object. Example
Dim Obj As GeoObject Dim C As GeoCurve Set Obj = C.GetGeoObject() ' Same as : Set Obj = C
GeoCurve
Page 84-2
Chapter 85 - GeoPolygon
Description A GeoPolygon is a GeoObject. A new GeoPolygon is created with the GeoMath method NewPolygon or simple by using Set GC = New GeoPolygon. Example
Dim GM As GeoMath Dim Poly As GeoPolygon Dim Pnts() As XYZ Set GM = New GeoMath Redim Pnts(1 To 5) 'Fill Pnts Set Poly = GM.NewPolygon(Pnts)
Properties
Methods
Properties
For a description of the properties Horizontal, Zsee object type GeoObject. NrOfPoints Returns
Long
Description This property returns the number of point of the Polygon . Example
Dim Poly As GeoPolygon MsgBox Poly.NrOfPoints
Area Returns
Double
Description This property returns the number of point of the Polygon . Example
Dim Poly As GeoPolygon MsgBox Poly.NrOfPoints
Perimeter Returns
Double
Description This property returns the perimeter (2D) of the Polygon. Example
Dim Poly As GeoPolygon Dim P As Double
GeoPolygon
Page 85-1
P = Poly.Perimeter
Centroid Returns
XY
Methods
SetPoints Parameters
Pnts() As XYZ
GetPoints Parameters
Pnts() As XYZ
Description GetGeoObject sets the reference to the GeoPolygon in a variable of type GeoObject. Note that the reference is copied, not the object. Example
Dim Obj As GeoObject Dim Poly As GeoPolygon Set Obj = Poly.GetGeoObject() ' Same as : Set Obj = Poly
GeoPolygon
Page 85-2
Chapter 86 - MatrixOperations
Description A MatrixOperations object is a collection of methods to do operations with or between two dimensional VBA Arrays. In this chapter we are calling a two dimensional array of Double values a matrix. In the methods of this chapter the input matrices can be one dimensional or two dimensional arrays. There is no restriction on lower bound or upper bound of these arrays. However, all output matrices will be created as two dimensional arrays. The lower bounds of these matrices will start from 1. See next example for illustration. Example
Dim Dim Dim Dim Mat As MatrixOperations A() As Double B() As Double AB() As Double
Set Mat = New MatrixOperations Redim A(0 To 2, 0 To 2) Redim B(1 To 3) A(0,0) = 1 A(0,1) = 1 A(0,2) = 1 A(1,0) = 1 A(1,1) = 1 A(1,2) = 1 A(2,0) = 1 A(2,1) = 1 A(2,2) = 1 B(1) = 5 B(2) = 10 B(3) = 20 Mat.Multiply A, B, AB MsgBox "x1 = " & CStr(AB(1,1)) & ", x2 = " & CStr(AB(2,1)) & ", x3 = " & CStr(AB(3,1))
Methods
Methods
NewMatrix Parameters
m As Integer, n As Integer, A() As Double
Description This method createsin A a double array with all elements equal to zero. The bounds of the matrix A will be defined as [1..m, 1..n]. Example
Dim Mat As MatrixOperations Dim A() As Double Dim i As Integer, j As Integer
MatrixOperations
Page 86-1
Set Mat = New MatrixOperations Mat.NewMatrix 3, 3, A For i = 1 To 3 For j = 1 To 3 If A(i,j) <> 0 Then MsgBox "Initialisation failed" End If Next j Next i
NewIdentityMatrix Parameters
n As Integer, A() As Double
Description This method creates in Aa double array representing theidentity matrix of dimension n. The bounds of the matrix A will be defined as [1..n, 1..n]. Example
Dim Dim Dim Dim Mat As MatrixOperations A() As Double i As Integer j As Integer
Set Mat = New MatrixOperations Mat.NewIdentityMatrix 3, A For i = 1 To 3 For j = 1 To 3 If i <> j Then If A(i,j) <> 0 Then MsgBox "Identity matrixincorrect" End If Else If A(i,j) <>1 Then MsgBox "Identity matrixincorrect " End If End If Next j Next i
Description This method returns True if all elements of A and B are equal. Both matrices should have the same dimensions. If not, False is returned. Example
Dim Mat As MatrixOperations Dim A() As Double Dim B() As Double Set Mat = New MatrixOperations Mat.NewIdentityMatrix 3, A Mat.NewIdentityMatrix 3, B If Not Mat.IsEqual(A, B) Then MsgBox "IsEqual failed" End If
MatrixOperations
Page 86-2
Add Parameters
A As Array() Of Double, B As Array() Of Double, C As Array() Of Double
Description This method adds the matrices A and B and stores the result into C. The dimensions of A and B should be the same. If we note the dimensions of A and B as m by n, then the bounds of C will be defined as [1..m, 1..n] Example
Dim Dim Dim Dim Dim Mat As MatrixOperations A() As Double B() As Double C() As Double i As Integer, j As Integer
Set Mat = New MatrixOperations Mat.NewIdentityMatrix 3, A Mat.NewIdentityMatrix 3, B Mat.Add A, B, C For i = 1 To 3 For j = 1 To 3 If I <> j Then If C(i,j) <> 0 Then MsgBox "Sum was incorrect" End If Else If C(i,j) <> 2 Then MsgBox "Sum was incorrect" End If End If Next j Next i
Multiply Parameters
A As Array() Of Double, B As Array() Of Double, C As Array() Of Double
Description This method multiplies the matrices A and B and stores the result into C. The number of columns in A should match the number of rows in B. If A holds m rows and n columns, if B holds o rows and p columns, the bounds of C will be defined as [1..m, 1..p]. Example
See example at the beginning of the chapter
Transpose Parameters
A As Array() Of Double, AT As Array() Of Double
Description This method defines the transposed matrix of A in AT. The element AT[j,i] will be equal to the element A[i,j]. If A holds m rows and n columns the bounds of AT will be defined as [1..n, 1..m]. Example
Dim Dim Dim Dim Mat As MatrixOperations A() As Double AT() As Double i As Integer, j As Integer
MatrixOperations
Page 86-3
= = = = = =
5 6 8 3 5 8
Mat.Transpose A, AT For i = 1 To 3 For j = 1 To 2 If A(i,j) <> AT(j,i) Then MsgBox "transpose failed" End If Next j Next i
Description This method defines the inverse matrix of A in AInverse. The calculation of the inverse matrix is only possible when the array is square (n by n) and when the array is regular. The parameter Okwill indicate if the inverse calculation was successful. If A holds m rows and n columns the bounds of AInverse will be defined as [1..m, 1..n]. Example
Dim Dim Dim Dim Dim Dim Mat As MatrixOperations A() As Double AInv() As Double Prod() As Double I() As Double Ok as Boolean
Set Mat = New MatrixOperations Redim A(1 To 3, 1 To 3) A(1,1) A(1,2) A(1,3) A(2,1) A(2,2) A(2,3) A(3,1) A(3,2) A(3,3) = = = = = = = = = 1 3 1 1 1 2 2 3 4
Ok = Mat.Inverse(A, AInv) If Not Ok Then MsgBox "Inverse calculation impossible" Else Mat.NewIdentityMatrix 3, I Mat.Multiply A, AInv, Prod If Not Mat.IsEqual(I, Prod) Then MsgBox "Inverse calculation is not correct" Else MsgBox "Inverse calculation calculated succesfully" End If End If
MatrixOperations
Page 86-4
Description This methods solves the lineair equation A.X = B. A solution will only be found under certain conditions: We need the matrix A to be regular and with dimensions n by n (square matrix). We only support matrices B of dimension n (by 1). The matrix X will be a matrix of dimensions [1..n, 1..1]. The return parameter Okwill be True when a solution was found, otherwise this method returns False. Example
Dim Dim Dim Dim Dim Mat As MatrixOperations A() As Double B() As Double X() As Double Ok as Boolean
Set Mat = New MatrixOperations Redim A(1 To 3, 1 To 3) Redim B(1 To 3) A(1,1) = 1 A(1,2) = 2 A(1,3) = -1 A(2,1) = 2 A(2,2) = -1 A(2,3) = 3 A(3,1) = 7 A(3,2) = -3 A(3,3) = -2 B(1) = 11 B(2) = 7 B(3) = 2 Ok = Mat.Solve(A, B, X) If Not Ok Then MsgBox "Equations were not solved" Else MsgBox "x1 = " & CStr(X(1,1)) & ", x2 = " & CStr(X(2,1)) & ", x3 = " & CStr(X(3,1)) End If
Description This method calculates the determinant of A. The calculation of the determinant is only possible when the array is square (n by n). Example
Dim Mat As MatrixOperations Dim A() As Double Dim det As Double Set Mat = New MatrixOperations Redim A(1 To 3, 1 To 3) A(1,1) = 1 A(1,2) = 3
MatrixOperations
Page 86-5
= = = = = = =
1 1 1 2 2 3 4
MatrixOperations
Page 86-6
Chapter 87 - HelmertTransformation
Description The HelmertTranformation object assist in executing a Helmert Transformation on a drawing or part of a drawing. The method Calculate will calculate the parameters used by the Helmert Transformation based on n pairs of points. These pairs are called pass points. The instance of a HelmertTranformation object retains not only the transformation parameters, but also the coordinates of the pairs of points on which the parameters where calculated. This allows to adjust the drawing after transformation. Adjustment (smoothing out residuals) in this context means that each object will be moved. The closure error (residuals) for the pass points will become 0. See also the method Transform which can be applied to Selection, FlaggedObjects and AllObjects. Example
Dim Dim Dim Dim Dim Dim Dim H As HelmertTransformation FromPnts() As XY, ToPnts() As XY Ok As Boolean NrPoints As Long All As AllObjects Doc As Document Drawing As Overlay
Set A = New Application Set H = New HelmertTransformation A.GetActiveDocument Doc Doc.GetOverlay ptDrawing, Drawing Drawing.GetAllObjects All GetNumberOfPoints NrPoints a specific procedure to get nr of points Redim FromPnts(1 To NrPoints) Redim ToPnts(1 To NrPoints) ReadPoints FromPnts, ToPnts a specific procedure to read points H.Calculate NrPoints, FromPnts, ToPnts, Ok If Ok Then All.Transform H, True End If
Properties
Methods
Properties
NumberOfPassPoints Returns
Long
Description This property returns the number of pass points used to calculate the transformation parameters. Example
Dim H As HelmertTransformation Dim Errors() As Long
HelmertTransformation
Page 87-1
TranformationParameters Returns
TransformationParameters
Description This property returns the transformation parameters. (See Pythagoras Types) Example
Dim H As HelmertTransformation Dim TPs As TransformationParameters TPs = H.TransformationParameters MsgBox "Angle = " & Format(H.TransformationParameters.RotationAngle, "#.###") MsgBox "Scale = " & Format(H.TransformationParameters.ScaleFactor, "#.####") MsgBox "dX = " & Format(H.TransformationParameters.dX, "#.###") MsgBox "dY = " & Format(H.TransformationParameters.dY, "#.###")
StandardDeviation Returns
Double
Description This property returns the standard deviation of the transformation. Example
Dim H As HelmertTransformation MsgBox Format(H.StandardDeviation, "0.###")
Methods
Calculate Parameters
NumberOfPassPoints As Long, Old() As XY, New() As XY, Ok As Boolean
Description Calculates the transformation parameters and keeps the result and the original pass points in the object. Example
Dim Dim Dim Dim Dim H As HelmertTransformation FromPnts() As XY, ToPnts() As XY Ok As Boolean NrPoints As Long All As AllObjects
Set H = New HelmertTransformation InitialiseData a specific procedure to initialize data H.Calculate NrPoints, FromPnts, ToPnts, Ok If Ok Then All.Transform H, True End If
GetResiduals Parameters
Residuals() As XY
Description Returns the residuals of the pass points if the Helmert Transformation would be applied. On return, the lower bound index will always be equal to 1. Example
Dim H As HelmertTransformation Page 87-2
HelmertTransformation
InitialiseData a specific procedure to initialize data H.Calculate NrPoints, FromPnts, ToPnts, Ok If Ok Then H.GetResiduals Residuals For i = 1 To NrPoints R.x = R.x + Residuals(i).x R.y = R.y + Residuals(i).y Next i End If
GetDelaunayTriangulation Parameters
Triangulation As DelaunayTriangulation
Description A Delaunay Triangulation based on the passpoints and with residuals as associated values is calculated and returned. The Delaunay Triangulation is saved together with the object so that methods using the Helmert Transformation may use the Delaunay Triangulation for interpolation purposes. See CoordinateReferenceSystems method TransformXYTo and the method Transform of Selection, FlaggedObjects and AllObjects. Example
Dim H As HelmertTransformation Dim T As DelaunayTriangulation H.GetDelaunayTriangulation T
Description Returns the transformed coordinate. For the meaning of optional parameter SmoothResidualssee Selection, FlaggedObjects, AllObjects method Transform. Example
Dim H As HelmertTransformation Dim P As Point, Pt As Point Pt = H.Transform(Pt, ptNNArea)
HelmertTransformation
Page 87-3
Chapter 88 - DelaunayTriangulation
Description The DelaunayTriangulation object calculates a Delaunay Triangulation of a set of points and provides tools to do some calculations using the Triangulation. Each vertex of a triangle may have n values. Where n may be 0 or any other higher value. For one instance of a DelaunayTriangulation all values must have the same dimension. A 1-dimensional value could represent an elevation of a point, a 2-dimensional value could for example indicate the residuals of passpoints. See method GetResiduals of the object HelmertTransformation. A DelaunayTriangulation object could be used in combination with a HelmertTransformation, CoordinateReferenceSystems and TiePoints to Transform data from one Coordinate Reference System to another using a set of Tie Points (pass points) and natural neighbours interpolation to smooth out the Residuals. See also the method Transform which can be applied to Selection, FlaggedObjects and AllObjects to transform a set of points to use Natural Neighbours interpolation. Example
Dim Dim Dim Dim DT As DelaunayTriangulation Points() As XYV NrPoints As Long T As Triangle
Set DT = New DelaunayTriangulation GetNumberOfPoints NrPoints Redim Points(1 To NrPoints) ReadPoints Points DT.Initialise NrPoints, Points DT.GetFirst T Do While T Is Not Nothing . . . DT.GetNext T Loop a specific procedure to get nr of points a specific procedure to read points and corresponding real values
Properties
Methods
Properties
NumberOfPoints Returns
Long
Description This property returns the number of points used to create Delaunay triangulation. Example
Dim DT As DelaunayTriangulation
DelaunayTriangulation
Page 88-1
NumberOfTriangles Returns
Long
Methods
Initialise Parameters
NumberOfPoints As Long, Points() As XYV
Description Creates a Delanay Triangulation with Points as basic set of points. The list of points should start from index 0. This method can raise the following errors: - Insuffient number of points or all points are collinear - There are 2 or more points with the same coordinates - Triangulation can not be calculated. Example See example above GetFirst Parameters
Triangle As Triangle
Description Returns first triangle of the Delanay Triangulation. Example See example above GetNext Parameters
Triangle As Triangle
Description Returns next triangle of the Delanay triangulation. Example See example above NaturalNeighbours Parameters
P As XY, Neighbours() As XYV
DelaunayTriangulation
Page 88-2
Dim NrPoints As Long Dim Neighbours() As XYV Dim P As XY Set DT = New DelaunayTriangulation GetNumberOfPoints NrPoints Redim Points(1 To NrPoints) ReadPoints Points a specific procedure to get nr of points a specific procedure to read points and corresponding real values
Interpolation Parameters
P As XY, InterpolationType As Integer, Res() As Double
Description Returns interpolated value for the given point P. The type of interpolation may be: ptInTrianglePlane, ptNNArea, ptNNDistance, ptAllDistances If no solution every dimension of Res = ptNilValue. The result list starts from index 0. Example
Dim Dim Dim Dim Dim DT As DelaunayTriangulation Points() As PointVal NrPoints As Long Res() As Double P As XY
Set DT = New DelaunayTriangulation GetNumberOfPoints NrPoints Redim Points(1 To NrPoints) ReadPoints Points a specific procedure to get nr of points a specific procedure to read points and corresponding real values
P.x = 10.0 P.y = 18.4 DT.Initialise NrPoints, Points DT.Interpolation P, ptNNArea, Res
DelaunayTriangulation
Page 88-3
Chapter 89 - XMLDocument
Description An object of this class describes an XML document in the sense of the XML standard. Objects of this class cannot be created by Set New statement; this statement merely stores Nothing. Objects of this class can be created by methods Application.CreateXMLDocument and Application.ReadXMLDocument. Example
Dim A As Application, Doc As XMLDocument, Name As String Dim Code As XMLCompletionCode, Position() As Location Dim Line As Long, Column As Long, I As Integer, S As String Set Doc = _ A.ReadXMLDocument ("C:\Parcels.xml", Completion:=Code, _ Line:=Line, Column:=Column) If Code = xmlcSuccess Then ' Analyze data in Doc Set Doc = Nothing ' Clear read data Else S = "Error " & Code & " in line " & Line & " column " & Column If A.GetXMLErrorPosition(Position) Then For I = LBound(Position) To UBound(Position) If Not A.UTF8ToASCII (Position(I).Entity, Name) Then Name = "(cannot be shown in current locale)" End If S = S & " -> " & Name & S = S & " line " & Position(I).Line S = S & " column " & Position(I).Column Next End If MsgBox S End If
Properties
Methods
Properties
Version Returns
XMLDocumentVersion
Description Sets or returns a version of XML standard the document complies with. Changing version for a non empty document is not recommended because it can cause errors if some existing data do not comply with a version set. The main difference between versions is different sets of permitted characters in text values. But an error can occur only when using characters that normally are not used. Example
Dim Doc As XMLDocument
Standalone Returns
Boolean
Description Sets or returns a standalone property of the document. The current version of Pythagoras processes only standalone documents. Therefore, setting this property influences only what value of standalone argument the document will be written with. Example
Dim Doc As XMLDocument Set Doc = New XMLDocument Doc.Standalone = False ' We wants that the output file will have attribute ' "standalone='no'" in the prolog
Comments1 Returns
XMLItems
Description Returns the queue of comments and PIs standing between an XML declaration (document header) and a DTD. If DTD is absent a queue returned will contains all comments and PIs standing between an XML declaration and the main element. Example
Dim Doc As XMLDocument Dim Misc1 As XMLItems, Misc2 As XMLItems, Misc3 As XMLItems Set Misc1 = Doc.Comments1 Set Misc2 = Doc.Comments2 Set Misc3 = Doc.Comments3
Comments2 Returns
XMLItems
Description Returns the queue of comments and PIs standing between a DTD and the main element. If DTD is absent an empty queue is returned. Example See example Comments1 Comments3 Returns
XMLItems
Description Returns the queue of comments and PIs standing after the main element. Example See example Comments1 Main Returns
XMLElement
XMLDocument
Page 89-6
Methods
Clear Parameters None Description All document content is deleted. However, the name of the main element is retained. Example
Dim A As Application, Doc As XMLDocument Set Doc = A.ReadXMLDocument ("c:\Old.xml") If Not Doc Is Nothing Then Doc.WhiteSpaceNormalize ' eliminate all not necessary whites ' Analyze data in Doc Else MsgBox "XML document cannot be read" End If Doc.Clear ' Fill Doc with some information If Doc.Save ("c:\New.xml") <> xmlcSuccess Then MsgBox "XML document cannot be written" End If Set Doc = Nothing
WhiteSpaceNormalize Parameters None Description White space normalization is done recursively through the whole document content. White space normalization process is described in details in the XML standard, see also description of Application.XMWhiteSpaceNormalize method in this document. This method recursively calls XMWhiteSpaceNormalizemethods for the main element and for all comments and PIs standing out of the main element. Example See example Clear Save Parameters
FullFilename As String, Optional WriteComments As Boolean = True, Optional WritePI As Boolean = True, Optional Encoding As IANACharset = csUTF8, Optional LineSeparator As String = vbCrLf, Optional MaxLine As Long = 80, ' Maximum line length ' (in characters except end of line characters) Optional Indentation As Byte = 2, ' Number of spaces to indent on one level Optional Quote As String = Chr(34)
XMLDocument
Page 89-7
Returns
XMLCompletionCode
Description The method writes content of the document to the file. The document remains untouched. Parameters WriteComments and WritePI define whether comments and PIs correspondingly will be written to the file. Encoding must be equal to one of supported by Windows. It is strongly recommended that Encoding will be one of Unicode encodings. Otherwise characters could be present that cannot be converted and they will be replaced. Non Unicode encodings should be used only when such encoding is necessary for an application that will read an XML file. LineSeparator is a string used to separate lines of an output text file. Only thefollowing values are allowed: <LF>, <CR><LF>, <CR>, <CR><NEL>, <NEL> and <LS>. Last three values can only be specified when version of the document is 1.1 and Encoding specifies a character set containing <NEL> or <LS> correspondingly. Note that any Unicode encoding contains these characters. Mentioned values can be coded in VBA in the following way correspondingly: vbLf, vbCrLf, vbCr, vbCr&Chr(194)&Chr(113), Chr(194)&Chr(133) and Chr(236)&Chr(128)&Chr(168). Note that the Unicode standard recommends <LS> as a line separator, however this recommendation is rarely followed. Both MaxLine and Indentation must be positive and are used to finely format an output file. Quote must be either a single or a double quote. Example See example Clear
XMLDocument
Page 89-8
Chapter 90 - XMLItem
Description An object of this class describes one of the following XML objects: a PI, a comment, an element or a piece of text being the element content. Objects of this class cannot be created by Set New statement. This statement merely stores Nothing. Objects of this class can be created by methods XMLItems.AddText, XMLItems.AddPI, XMLItems.AddComment and XMLItems.AddElement. Example
Dim Doc As XMLDocument, Item As XMLItem Set Item = Doc.Main.SubItems.FirstItem ' Get the first subitem of the main element of Doc While Not Item Is Nothing ' ... process an item ... Set Item = Doc.Main.SubItems.NextItem WEnd
Properties
Properties
ItemType Returns
XMLItemType
Text Returns
XMLText
Description The property returns the same item but represented as an object of class XMLText. If the item is not a text item, Nothing is returned. Example
Dim A As Application, I As XMLItem, T As XMLText Set T = I.Text If Not T Is Nothing Then MsgBox "Content is " & A.UTF8ToASCIIV(T.Content) End If
PI Returns
XMLPI
Description The property returns the same item but represented as an object of class XMLPI. If the item is not a PI, Nothing is returned. Example
Dim A As Application, I As XMLItem, PI As XMLPI Set PI = I.PI If Not PI Is Nothing Then MsgBox "PI target is " & A.UTF8ToASCIIV(PI.Target) End If
Comment Returns
XMLComment
Description The property returns the same item but represented as an object of class XMLComment. If the item is not comment, Nothing is returned. Example
Dim A As Application, I As XMLItem, C As XMLComment Set C = I.Comment If Not C Is Nothing Then MsgBox "Comment content is " & A.UTF8ToASCIIV(C.Content) End If
Element Returns
XMLElement
Description The property returns the same item but represented as an object of class XMLElement. If the item is not an element, Nothing is returned. Example
Dim I As XMLItem, E As XMLElement Set E = I.Element If Not E Is Nothing Then MsgBox "Element name is " & E.Name End If
Document Returns
XMLDocument
Description The property returns an XML document the item is a part of. Example
Dim I As XMLItem If I.Document.Version = xmlV1_1 Then ' ... End If
NextItem Returns
XMLItem
XMLItem
Page 90-10
Description The property returns an item standing after that item in a queue. It can be used to scan items in the queue. Example
Dim Doc As XMLDocument, Item As XMLItem Set Item = Doc.Main.SubItems.FirstItem ' Get the first subitem of the main element of Doc While Not Item Is Nothing ' process an item Set Item = Item.NextItem WEnd
WhiteSpace Returns
XMLWhiteSpaceFacet
Description Sets or returns a value defining how spaces will be processed during normalization. For textual items it is ignored. For elements it defines normalization process for textual subitems. By default this property is set to xmlCollapse. Example
Dim Element As XMLelement Element.WhiteSpace = xmlReplace ' Define that in a subsequent call of WhiteSpaceNormalize method ' blanks will not be deleted in textual content of this element XMLItems
Description Each object of this class describes a queue of XML items. Objects of this class cannot be created by Set New statement. This statement merely stores Nothing. An object of this class is created together with its parent (either an XML document or an element).
XMLItem
Page 90-11
Chapter 91 - XMLItems
Description Only one object of this class exists for an item queue. Therefore, when getting an object of this class twice (using property Element.Items, for example), the same object is returned. Embedded or parallel scanning is possible using XMLItem.Next property. Example See example class XMLItem Properties
Parent NrOfItems CurrentItem FirstItem NextItem NrOfElements FirstElement NextElement Clear Copy WhiteSpaceNormalize AddText AddPI AddComment AddElement RemoveItem
Methods
Properties
Parent Returns
Variant (XMLElement or XMLDocument)
Description Returns an element or an XML document this item directly belongs to. A document is returned only for PIs and comments being outside the main document. Example
Dim Queue As XMLItems, P As Variant, E As XMLElement Dim OfCoordinates As Boolean ' define if Queue is a queue of an element with name "Coordinates" Set P = Queue.Parent OfCoordinates = False If TypeName(P) = "XMLElement" The Set E = P OfCoordinates = E.Name = "Coordinates" End If
NrOfItems Returns
Long
Description Returns the number of items in the queue. Note that number of items is not stored anywhere. It will be calculated each time you access this property. Example
Dim Queue As XMLItems, N As Long
N = Queue.NrOfItems
CurrentItem Returns
XMLItem
Description Returns the current item in the queue. Initially it is the first item of a queue. Subsequent methods can change the current item. When the current item is undefined Nothing is returned. FirstItem Returns
XMLItem
Description Returns the first item of the queue. The returned item becomes current. If the queue is empty Nothing is returned. Example See example class XMLItem NextItem Returns
XMLItem
Description Returns the next item after the current one. The returned item becomes current. If the current item was the last,Nothing is returned. Example See example class XMLItem NrOfElements Returns
Long
Description Returns the number of elements in the queue. Note that the number of elements is not stored anywhere. It will be calculated each time you access this property. Example
Dim Queue As XMLItems, N As Long N = Queue.NrOfElements
FirstElement Returns
XMLElement
Description Returns the first item being an element.The returned item becomes current. If the queue contains no elements then Nothing is returned. Example
Dim A As Application, Doc As XMLDocument, Element As XMLElement Dim S As String S = "" Set Element = Doc.Main.SubItems.FirstElement ' Get the first subelement of the main element of Doc
XMLItems
Page 91-14
While Not Element Is Nothing S = S & " " & A.UTF8ToASCIIV(Element.Name) Set Element = Doc.Main.SubItems.NextElement WEnd MsgBox "The document contains subelements with names:" + S
NextElement Returns
XMLElement
Description Returns the first item after the current one being an element. The returned item becomes current. If the queue contains no more elements then Nothing is returned. Example See example FirstElement
Methods
Clear Parameters None Description All queue items are destroyed, the queue becomes empty. Example
Dim Doc As XMLDocument Doc.Main.SubItems.Clear ' Delete the whole main element content
Copy Parameters
Dest As XMLItems
Description Destis cleared, then the current queue is copied to Dest. For element items both attributes and subitems of all levels are copied. Example
Dim Doc1 As XMLDocument, Doc2 As XMLDocument Doc1.Main.SubItems.Copy Doc2.Main.SubItems ' Copy the whole main element content
WhiteSpaceNormalize Parameters None Description For text in all text items white space normalization is provided accordingly to the element WhiteSpace property value. Also WhiteSpaceNormalize method is called for all other items. See also method Application.WhiteSpaceNormalize description. Example
Dim Doc As XMLDocument Doc.Main.SubItems.WhiteSpaceNormalize
XMLItems
Page 91-15
AddText Parameters
Content As String, Optional Position As PTPosition = ptEnd, Optional UniteText As Boolean = True, Optional SpaceBefore As Boolean = False XMLText
Returns
Description A new text item is inserted. Inserted text is inserted as it is without white space normalization. A new text item is inserted correspondingly to Position argument value: either before the first element of the queue, or before the current item, or after the current item, or after the last item. In the third case the inserted item becomes current. If UniteText = True and before or after the inserted item another text item stands then the inserted item is united with that item. UniteText = False could be useful when the programmer wants to insert another item after the just inserted one. SpaceBefore flag signals that space should be present before inserted text; see also description of XMLText.SpaceBefore property. The inserted (and possibly united) text item is returned. Note. The XML standard declares that any line separator should be converted to <LF> during input. Therefore any text parameters should not contain other line separators than <LF>s. Example
Dim Element As XMLElement, Text As XMLText Element.SubItems.Clear Set Text = Element.SubItems.AddText "3.14" ' Set content of Element to the textual value
AddPI Parameters
Target As String, Optional Content As String = "", Optional Position As PTPosition = ptEnd, Optional WhiteSpace As XMLWhiteSpaceFacet = wsCollapse XMLPI
Returns
Description A new processing instruction is inserted. Target and Content must correspond to the following requirements of the XML standard: Target has to be a well-formed name not equal to "XML" (in any letter case), Content has not to contain character sequence "?>". Content is inserted as it is without white space normalization. The new PI is inserted correspondingly to Position argument value: either before the first element of the queue, or after the current item, or after the last item. In the second case the PI becomes current item. The inserted PI is returned. See also note AddText. Example
Dim Element As XMLElement, PI As XMLPI Set PI = Element.SubItems.AddPI "php", "echo $a;"
XMLItems
Page 91-16
AddComment Parameters
Content As String, Optional Position As PTPosition = ptEnd, Optional WhiteSpace As XMLWhiteSpaceFacet = wsCollapse XMLComment
Returns
Description A new comment is inserted. Content must correspond to the requirement of the XML standard that it has not to contain character sequence "--". Content is inserted as it is without white space normalization. The new comment is inserted correspondingly to Position argument value: either before the first element of the queue, or after the current item, or after the last item. In the second case the comment becomes the current item. The inserted comment is returned. See also note AddText. Example
Dim Element As XMLElement, Comment As XMLComment Set Comment = _ Element.SubItems.AddComment _ "This element describes an enclosing rectangle"
AddElement Parameters
Name As String, Optional Content As String = "", Optional Position As PTPosition = ptEnd, Optional WhiteSpace As XMLWhiteSpaceFacet = wsCollapse XMLElement
Returns
Description A new element is inserted. Name must be a well-formed name in sense of the XML standard. The inserted element contains no attribute. If parameter Content is not empty then the element contains only one text subitem with the specified text, otherwise the element contains no subitem. The new element is inserted correspondingly to Position argument value: either before the first element of the queue, or after the current item, or after the last item. In the second case the comment becomes the current item. The inserted element is returned. See also note AddText. Example
Dim Element As XMLElement, SubElement As XMLElement Set SubElement = Element.SubItems.AddElement "triangle"
RemoveItem Parameters
Optional UniteText As Boolean = True
Description The current item is deleted. If it is an element it is deleted together with all subitems. The next item becomes current. If the current item is not defined then nothing is done.
XMLItems
Page 91-17
XMLItems
Page 91-18
Chapter 92 - XMLText
Description An object of this class describes a piece of text being inside an element content and limited on the left side either by an element start tag or by a subelement orby a comment or by a PI. On the right side it is limited either by a subelement or by a comment or by a PI or by an element end tag. Objects of this class cannot be created by Set New statement. This statement merely stores Nothing. Objects of this class can be created by method XMLItems.AddText. Example See example class XMLItem.Text Properties
Item NextItem Document Content SpaceBefore
Properties
Item Returns
XMLItem
Description Returns the same textual item but represented as an object of class XMLItem. It is useful where other type is syntactically required. Example
Dim Item As XMLItem, Text As XMLText, Same As Boolean Same = Item = Text.Item ' Check that they are the same item
NextItem Returns
XMLItem
Description The property returns an item standing after that item in a queue. It can be used to scan items in the queue. Example
See XMLItem.NextItem
Document Returns
XMLDocument
Description The property returns the XML document the text is a part of. Example
See XMLItem.Document
Content Returns
String
Description Sets or returns the textual content of the item. See also note XMLItem.AddText. Example
Dim Text As XMLText Text.Content = Text.Content & " *" ' Add a blank and asterisk to the text
SpaceBefore Returns
Boolean
Description Sets or returns a special flag value. The flag has a meaning only when the parent document has WhiteSpace = wsCollapse and has mixed content. This flag signals that content of the item should be space separated from content of the previous text item. Let us illustrate this by the following example. An XML element is like <list>1<stop/> 5</list>, it contains two textual items separated by a subelement. After white space collapse normalization content of these items will be "1" and "5" respectively. Content of the element will be "15" what is not correct. It should be "1 5" instead. To avoid such mistakes, the second text item should be marked by a SpaceBefore flag equal to True during white space collapse normalization. This property should be explicitly used in exceptional cases only.
XMLText
Page 92-20
Chapter 93 - XMLPI
Description An object of this class describes a so called processing instruction. Objects of this class cannot be created by Set New statement. This statement merely stores Nothing. Objects of this class can be created by method XMLItems.AddPI. Example See example class XMLItem.PI Properties
Item NextItem Document Target Content WhiteSpace
Properties
Item Returns
XMLItem
Description Returns the same textual item but represented as an object of class XMLItem. It is useful where other type is syntactically required. Example
Dim Item As XMLItem, PI As XMLPI, Same As Boolean Same = Item = PI.Item ' Check that they are the same item
NextItem Returns
XMLItem
Description The property returns an item standing after that item in a queue. It can be used to scan items in the queue Example
See XMLItem.NextItem
Document Returns
XMLDocument
Description The property returns an XML document the PI is a part of. Example
See XMLItem.Document
Target Returns
String
Description Sets or returns a target of a PI. New target must be a well-formed XML name not being XML (in any letter case).
Example
Content Returns
String
Description Sets or returns the content of a PI, called also a command. The new content must not contain "?>" inside. See also note XMLItem.AddText. Example
Dim PI As XMLPI PI.Content = "6 34"
WhiteSpace Returns
XMLWhiteSpaceFacet
Description Sets or returns a value defining how spaces will be processed during normalization. Initially this property is set to xmlCollapse. Example
See XMLItem.Whitespace
XMLPI
Page 93-22
Chapter 94 - XMLComment
Description An object of this class describes a comment. Objects of this class cannot be created by Set New statement. This statement merely stores Nothing. Objects of this class can be created by method XMLItems.AddComment. Example See example class XMLItem.PI Properties
Item NextItem Document Content WhiteSpace
Properties
Item Returns
XMLItem
Description Returns the same textual item but represented as an object of class XMLItem. It is useful where other type is syntactically required. Example
Dim Item As XMLItem, Comment As XMLComment, Same As Boolean Same = Item = Comment.Item ' Check that they are the same item
NextItem Returns
XMLItem
Description The property returns an item standing after that item in a queue. It can be used to scan items in the queue. Example
See XMLItem.NextItem
Document Returns
XMLDocument
Description The property returns the XML document the comment is a part of. Example
See XMLItem.Document
Content Returns
String
Description Sets or returns the comment text. A new comment must not contain "--" inside.
Whitespace Returns
XMLWhiteSpaceFacet
Description Sets or returns a value defining how spaces will be processed during normalization. It defines normalization process for the textual subitems. Initially this property is set to xmlCollapse. Example
See XMLItem.Whitespace
XMLComment
Page 94-24
Chapter 95 - XMLElement
Description An object of this class describes an XML element. Objects of this class cannot be created by Set New statement. This statement merely stores Nothing. Main elements of XML documents are created together with their documents. Other objects of this class can be created by method XMLItems.AddElement. Example See example XMLItems.FirstElement Properties
Item NextItem Document NextElement NrOfAttribites FirstAttribute WhiteSpace Name Value SubItems GetAttribute AddAttribute RemoveAttribute RemoveAttributes CopyAttributes Clear Copy WhiteSpaceNormalize
Methods
Properties
Item Returns
XMLItem
Description Returns the same element but represented as an object of class XMLItem. It is useful where other type is syntactically required. Example
Dim Item As XMLItem, Element As XMLElement, Same As Boolean Same = Item = Element.Item ' Check that they are the same item
NextItem Returns
XMLItem
Description The property returns an item standing after that item in a queue. It can be used to scan items in the queue Example
See XMLItem.NextItem
Document Returns
XMLDocument
Description The property returns the XML document the item is a part of. Example
See XMLItem.Document
Whitespace Returns
XMLWhiteSpaceFacet
Description Sets or returns a value defining how spaces will be processed during normalization. It defines normalization process for the textual subitems. Initially this property is set to xmlCollapse. Example
See XMLItem.Whitespace
NextElement Returns
XMLElement
Description Returnsthe next element in the queue. If there are no more elements in the queue Nothing is returned. Example
Dim A As Application, Doc As XMLDocument, Element As XMLElement Dim S As String S = "" Set Element = Doc.Main.SubItems.FirstElement ' Get the first subelement of the main element of Doc While Not Element Is Nothing S = S & " " & A.UTF8ToASCIIV(Element.Name) Set Element = Element.NextElement WEnd MsgBox "The document contains subelements with names:" & S
NrOfAttributes Returns
Long
Description Returns the number of attributes. Example See example FirstAttribute FirstAttribute Returns
XMLAttribute
Description The first attribute of the element is returned. The attributes are ordered in the lexicographic order of their names coded in Unicode. If the element contains no attribute, Nothing is returned. This property can be used together with XMLAttribute.Next property to look through all element attributes.
XMLElement
Page 95-26
Example
Dim Element As XMLElement, Attr As XMLAttribute Dim S As String S = _ "Element " & Element.Name & " contains " & _ Element.NrOfAttributes & " attributes:" & vbCrLf Set Attr = Element.FirstAttribute While Not Attr Is Nothing S = S & Attr.Name & " = " & Attr.Value Select Case Attr.WhiteSpace Case xmlReplace S = S & " (replace)" Case xmlCollapse S = S & " (collapse)" End Select S = S & vbCrLf Set Attr = Attr.NextAttribute WEnd MsgBox S
Name Returns
String
Description Sets or returns the name of the element. The new name must be a well-formed XML name. Example
Doc As XMLDocument MsgBox "The document main element has name " & Doc.Main.Name
Value Returns
String
Description Returns the united text from all text subitems normalized accordingly to the WhiteSpace property value of the element. For an example how to store the new value see XMLItems.AddText. Example
Dim A As Application, Element As XMLElement, Height As Long Height = A.XMLStringToInteger(Element.Value)
SubItems Returns
XMLItems
Methods
GetAttribute Parameters
Name As String
XMLElement
Page 95-27
Returns
Variant(String)
Description Returns a value of the attribute with the specified name. If an attribute with such name is absent, Empty is returned. Example
Dim Element As XMLElement, V As Variant, InInches As Boolean V = Element.GetAttribute ("Unit") InInches = (VarType(V) = vbString) And (V = "Inch")
AddAttribute Parameters
Name As String, Value As String, Optional WhiteSpace As XMLWhiteSpaceFacet = wsCollapse
Description Adds a new attribute with the specified name, value and white space facet. Name must be a well-formed XML name. If an attribute with such name is already present, its value and white space facet are changed to the specified ones. See also note XMLItem.AddText. Example
Dim Element As XMLElement Element.AddAttribute ("Unit", "Inch")
RemoveAttribute Parameters
Name As String
CopyAttributes Parameters
Dest As XMLElement
Description All attributes of Dest are deleted. Then all attributes are copied from this element to Dest. Example
Dim E1 As XMLElement, E2 As Element E1.CopyAttributes E2
XMLElement
Page 95-28
Clear Parameters None Description All content of the element is deleted. Particularly all attributes and all subitems are deleted. However a name and a white space facet of the element are retained. Example
Dim Element As XMLElement Element.Clear
Copy Parameters
Dest As XMLElement
Description All content of Dest is deleted, then all content of this element is copied to Dest. Particularly a name, all attributes, a white space facet and all subitems are copied. Example
Dim E1 As XMLElement, E2 As Element E1.Copy E2
WhiteSpaceNormalize Parameters None Description WhiteSpaceNormalize method is called for the subitem queue (see its description) and all attribute values are normalized as well. Example
Dim Doc As XMLDocument Doc.Main.WhiteSpaceNormalize
XMLElement
Page 95-29
Chapter 96 - XMLAttribute
Description An object of this class describes an XML attribute. Objects of this class cannot be created by Set New statement. This statement merely stores Nothing. Objects of this class can be created by method XMLElement.AddAttribute. Example See example XMLElement.FirstAttribute Properties
Element Name Value WhiteSpace NextAttribute
Properties
Element Returns
XMLElement
Name Returns
String
Description Returns the name of the attribute. Example See example XMLAttributes Value Returns
String
Description Sets or returns a value of the attribute. Example See example XMLAttributes WhiteSpace Returns
XMLWhiteSpaceFacet
Description Returns the next attribute. Attributes are ordered in lexicographical order of their names written in Unicode. If there are no more attributes Nothing is returned. Example See example XMLElement.FirstAttribute
XMLAttribute
Page 96-32
AltitudeMode = ClampToGround | RelativeToGround | Absolute Longitude = RealNumber (* -180 <= Longitude <= 180 *) Latitude = RealNumber (* -90 <= Latitude <= 90 *)
KML Introduction
Page 97-34
Example
The following macro generates and saves a KML file and displays the result in Google Earth. You need to have a drawing in a CRS (e.g. UTM, GK, ...) containing points. Only the points will be exported to KML.
Dim Dim Dim Dim A As Application Doc As Document DestCRS As CoordinateReferenceSystem CRSs As CoordinateReferenceSystems
Sub PM_ExportPointsToGoogleEarth Dim mf As KMLFolder Dim dir As String Dim docName As String Dim fname As String Dim gei As Object Dim bres As Long, backSlash As Long Set A = New Application A.GetCoordinateReferenceSystems CRSs CRSs.GetCoordinateReferenceSystem "WGS84", DestCRS A.GetActiveDocument Doc If Doc Is Nothing Then Exit Sub End If ProcessPoints mf If (Not (mf Is Nothing)) And (Not (Doc Is Nothing)) Then Set gei = CreateObject("GoogleEarth.ApplicationGE") If gei Is Nothing Then MsgBox "Google Earth is not installed" Exit Sub End If fname = "C:\TestExample.kml" mf.Save fname A.Wait 500 Do bres = gei.IsInitialized If bres <> 0 Then Exit Do Loop gei.OpenKmlFile(fname, True) Set gei = Nothing End If End Sub
Sub AddFeature(ByRef mfeats As KMLFeatures, afeat As KMLFeature, aname As String) Dim feat As KMLFeature Dim feats As KMLFeatures Dim name As String Dim folder As KMLFolder Dim mfi As KMLFeaturesIterator Dim found As Boolean Set mfi = mfeats.Iterator mfi.GetFirst feat Set folder = Nothing found = False While Not ((feat Is Nothing) Or found) If feat.FeatureType = ptKMLFolder Then feat.GetFolder folder If StrComp(folder.name, aname) = 0 Then found = True End If End If If Not found Then
KML Introduction
Page 97-35
mfi.GetNext feat End If Wend If Not found Then Set folder = New KMLFolder folder.Name = aname folder.GetFeature feat mfeats.Add feat Set feats = New KMLFeatures Set folder.Features = feats End If Set feats = folder.Features feats.Add afeat End Sub
Sub DoPnt(pnt As Point, ByRef feat As KMLFeature) Dim p3 As XYZ Dim p2 As XY Dim LatLong As XY Dim kgp As KMLGeoPoint Dim pm As KMLPlacemark Dim geom As KMLGeometry Dim pt As KMLPoint Dim color As KMLColor Set feat = Nothing p3 = pnt.Coordinates color.Red = pnt.TrueColor.Red color.Green = pnt.TrueColor.Green color.Blue = pnt.TrueColor.Blue color.Alpha = 255 If Doc.TransformPossible(DestCRS) Then p2.X = p3.X p2.Y = p3.Y LatLong = Doc.TransformXYTo(DestCRS, p2) kgp.Longitude = LatLong.Y kgp.Latitude = LatLong.X kgp.Altitude = p3.Z Set pt = New KMLPoint pt.GeoPoint = kgp Else Set feat = Nothing Exit Sub End If Set pm = New KMLPlacemark pm.Name = pnt.Layer pm.SetIconStyle color, 1.0, "C:\MyIcon" pt.GetGeometry geom Set pm.Geometry = geom pm.GetFeature feat End Sub
Sub ProcessPoints(ByRef mf As KMLFolder) Dim obs As Selection Dim o As CadObject Dim N As Long Dim i As Long Dim pnt As Point Dim feat As KMLFeature Dim mfeats As KMLFeatures Doc.GetSelection obs Set mfeats = New KMLFeatures Set mf = New KMLFolder
KML Introduction
Page 97-36
N = obs.Count(ptPoint) obs.GetFirst ptPoint, o For i = 1 To N If o Is Nothing Then ' No more objects Else o.GetPoint pnt DoPnt pnt, feat If Not (feat Is Nothing) Then AddFeature mfeats, feat, o.Layer End If End If obs.GetNext o Next i Set mf.Features = mfeats End Sub
KML Introduction
Page 97-37
Chapter 98 - KMLFolder
Description A KMLFolder object has a name, a list of KML Features, and a collection of methods to add and remove KML Features. Example
Dim KF As KMLFolder Set KF = New KMLFolder KF.Name = "NewFolder"
Properties
Methods
Properties
Name Returns
String
Description This property sets or returns the name of the KML Folder. Example
Dim KF As KMLFolder Set KF = New KMLFolder MsgBox KF.Name
Features Returns
KMLFeatures
Description This property sets or returns a KMLFeatures object in the KML folder. Example
Dim Features As KMLFeatures Dim KF As KMLFolder Set Features = New KMLFeatures Set KF = New KMLFolder Set KF.Features = Features
Methods
GetFeature Parameters
Feature As KMLFeature
Description This method sets the reference to the KMLFolder in a variable of type KMLFeature. Note that the reference is copied, not the object. Example
KMLFolder
Page 98-1
Save Parameters
FileName As String
Description The contents of the KMLFolder object is saved as a file in KML format. Example
Dim KF As KMLFolder Set KF = New KMLFolder KF.Save "C:\MyRegion.kml"
KMLFolder
Page 98-2
Chapter 99 - KMLFeatures
Description A KMLFeatures object contains a list of KMLFeature objects and contains properties and methods to manage this list. Example
Dim FS As KMLFeatures Set FS = New KMLFeatures
Properties
Methods
Properties
NrOfFeatures Returns
Long
Description This property returns the number of KMLFeature objects in the list. Example
Dim FS As KMLFeatures Dim n As Long n = FS.NrOfFeatures
IsEmpty Returns
Boolean
Description This property returns True if the list of KMLFeature objects is empty. Example
Dim FS As KMLFeatures If Not FS.IsEmpty Then '... End If
Iterator Returns
KMLFeaturesIterator
KMLFeatures
Page 99-1
Methods
Add Parameters
Feature As KMLFeature
Clear Parameters
None
Description This method clears the KMLFeatures object. The list will become empty. Example
Dim FS As KMLFeatures FS.Clear
KMLFeatures
Page 99-2
Properties
Methods
Properties
Valid Returns
Boolean
Description This property returns False if the iterator is invalid and may not be used anymore. (See description at the start of this chapter.) Example
Dim FSI As KMLFeaturesIterator If FSI.Valid Then ' .... End If
EndOfList Returns
Boolean
Description This property returns True if the iterator is at the end of the list. Example
Dim FSI As KMLFeaturesIterator While Not FSI.EndOfList ' .... Loop
Methods
GetFirst Parameters
Feature As KMLFeature
KMLFeaturesIterator
Page 100-1
GetNext Parameters
Feature As KMLFeature
Insert Parameters
Feature As KMLFeature, Position As Long
Description A KMLFeature is inserted in the list at the position specified by parameter Position. The valid values of Position are: PtBegin,PtEnd, ptBefore or ptAfter. ptBefore and ptAfter refer to the positions just before or just after the Feature obtained by the methods GetFirst and GetNext. The current position in the list will be the position of the element that is last inserted. Example
Dim FSI As KMLFeaturesIterator Dim F As KMLFeature Dim NewF As KMLFeature FSI.GetFirst F Do While Not FSI.EndOfList If SomeCondition(F) Then FSI.Insert NewF, ptBefore Exit Do End If FSI.GetNext F Loop
Remove Parameters
F As KMLFeature
Description This method removes the specified feature from the list. Example
Dim FSI As KMLFeaturesIterator Dim F As KMLFeature FSI.GetFirst F If SomeCondition(F) Then FSI.Remove F End If
KMLFeaturesIterator
Page 100-2
Properties Methods
Properties
FeatureType Returns
Long
Description This property returns the type of the KMLFeature object: ptKMLPlacemark or ptKMLFolder. Example
Dim F As KMLFeature Dim Folder As KMLFolder If F.FeatureType = ptKMLFolder Then F.GetFolder Folder End If
Methods
GetPlacemark Parameters
P As KMLPlacemark
Description This method sets the reference to the object in a variable of type ptKMLPlacemark. Example
See introduction
GetFolder Parameters
F As KMLFolder
Description This method sets the reference to the object in a variable of type ptKMLFolder.
KMLFeature
Page 101-1
Example
See introduction
KMLFeature
Page 101-2
Properties
Methods
Properties
Name Returns
String
Description This property sets or returns the name of the KML Placemark. Example
See introduction.
Geometry Returns
KMLGeometry
Description This property sets or returns the Geometry of the KML Placemark. Example
Dim Placemark As KMLPlacemark Dim Geo As KMLGeometry Set Placemark.Geometry = Geo
Methods
GetFeature Parameters
F As Feature
Description This method sets the reference to the object in a variable of type KMLFeature. Example
Dim F As KMLFeature Dim Placemark As KMLPlacemark
KMLPlacemark
Page 102-1
Placemark.GetFeature F
SetLineStyle Parameters
Color As KMLColor, Width As Double
Description This method sets the color and the line width of the Line Strings or Polygon Boundaries in the Geometry of the Placemark. Example
Dim PM As KMLPlacemark Dim Color As KMLColor Set PM = New KMLPlacemark PM.SetLineStyle Color, 1.5
GetLineStyle Parameters
Color As KMLColor, Width As Double
Description This method returns the color and the line width of the Line Strings or Polygon Boundaries in the Geometry of the Placemark. Example
Dim PM As KMLPlacemark Dim Color As KMLColor Dim Width As Double PM.GetLineStyle Color, Width
SetPolyStyle Parameters
Color As KMLColor, Fill As Boolean
Description This method sets the color and the fill flag of the Polygon in the Geometry of the Placemark. Example
Dim PM As KMLPlacemark Dim Color As KMLColor PM.SetPolyStyle Color, True
GetPolyStyle Parameters
Color As KMLColor, Fill As Boolean
Description This method returns the color and the fill flag of the Polygon in the Geometry of the Placemark. Example
Dim PM As KMLPlacemark Dim Color As KMLColor Dim Fill As Boolean PM.GetPolyStyle Color, Fill
SetIconStyle Parameters
Color As KMLColor, Scale As Double, IconName As String
Description This method sets the color, the scale and the name of the icon in the Geometry of the Placemark. KMLPlacemark
Page 102-2
Example
Dim PM As KMLPlacemark Dim Color As KMLColor Set PM = New KMLPlacemark PM.SetIconStyle Color, 2.5, "MyIcon"
GetIconStyle Parameters
Color As KMLColor, Scale As Double, IconName As String
Description This method gets the color, the scale and the name of the icon in the Geometry of the Placemark. Example
Dim Dim Dim Dim PM As KMLPlacemark Color As KMLColor Scale As Double Name As String
KMLPlacemark
Page 102-3
If G.GeometryType = ptKMLPolygon Then G.GetPolygon Poly ElseIf G.GeometryType = ptKMLPoint Then G.GetPoint P ElseIf G.GeometryType = ptKMLLineString Then G.GetLineString LS End If
Properties Methods
Properties
GeometryType Returns
Long
Description This property returns the type of the KMLGeometry object. The value is either: ptKMLPoint, ptKMLLineString or ptKMLPolygon. Example
Dim G As KMLGeometry Dim Type as Long Type = G.GeometryType
Methods
GetPoint Parameters
P As KMLPoint
Description This method sets the reference to the KMLGeometry in a variable of type KMLPoint. Example
Dim G As KMLGeometry Dim P As KMLPoint G.GetPoint P
KMLGeometry
Page 103-1
GetLineString Parameters
L As KMLLineString
Description This method sets the reference to the KMLGeometry in a variable of type KMLLineString. Example
Dim G As KMLGeometry Dim L As KMLLineString G.GetLineString L
GetPolygon Parameters
P As KMLPolygon
Description This method sets the reference to the KMLGeometry in a variable of type KMLPolygon. Example
Dim G As KMLGeometry Dim P As KMLPolygon G.GetPolygon P
KMLGeometry
Page 103-2
Properties Methods
GeoPoint GetGeometry
Properties
GeoPoint Returns
KMLGeoPoint
Description This property sets or returns the coordinates of the point. Example
Dim P As KMLPoint Dim Pos As KMLGeoPoint Pos = P.GeoPoint
Methods
GetGeometry Parameters
G As KMLGeometry
Description This method sets the reference to the KMLPoint in a variable of type KMLGeometry. Example
Dim G As KMLGeometry Dim P As KMLPoint P.GetGeometry G
KMLPoint
Page 104-1
Properties
Methods
Properties
Coordinates Returns
KMLCoordinates
Description This property sets or returns the coordinates of the vertices of the KMLLineString. Example
Dim L As KMLLineString Dim Coords As KMLCoordinates Set Coords = L.Coordinates
LinearRing Returns
Boolean
Description This property sets or returns the indication that the KMLLineString is a closed line string. As linear ring is used, in particular, as an outer bound of a polygon. Example
Dim L As KMLLineString L.LinearRing = True
AltitudeMode Returns
Long
Description This property sets or returns the altitude mode. The value can be ptClampToGround, ptRelativeToGround or ptAbsoluteAltitude. The meaning of those modes is defined in the KML Reference manual of Google. Example
Dim L As KMLLineString L.AltitudeMode = ptClampToGround
KMLLineString
Page 105-1
Extruded Returns
Boolean
Description This property sets or returns the indication Extruded of the KMLLineString. Specifies whether to connect the LineString to the ground. For more information see the KML Reference manual of Google. Example
Dim L As KMLLineString L.Extruded = True
Methods
GetGeometry Parameters
G As KMLGeometry
Description This method sets the reference to the KMLLineString in a variable of type KMLGeometry. Example
Dim G As KMLGeometry Dim L As KMLLineString L.GetGeometry G
KMLLineString
Page 105-2
Properties
Methods
Properties
AltitudeMode Returns
Long
Description This property sets or returns the altitude mode. The value can be ptClampToGround, ptRelativeToGround or ptAbsoluteAltitude. The meaning of those modes is defined in the KML Reference manual of Google. Example
Dim L As KMLLineString L.AltitudeMode = ptRelativeToGround
Extruded Returns
Boolean
Description This property sets or returns the indication Extruded of the KMLPolygon. Specifies whether to connect the polygon to the ground. For more information see the KML Reference manual of Google. Example
Dim L As KMLLineString L.Extruded = True
OuterBoundary Returns
KMLCoordinates
Description This property sets or returns the outer boundary of the KMLPolygon. The first and the last coordinate must be the same. Example
Dim L As KMLPolygon
KMLPolygon
Page 106-1
InnerBoundary Returns
KMLCoordinates
Description This property sets or returns the inner boundary of the KMLPolygon. Example
Dim L As KMLPolygon Dim Inner As KMLCoordinates Set Poly.InnerBoundary = Inner
Methods
GetGeometry Parameters
G As KMLGeometry
Description This method sets the reference to the KMLPolygon in a variable of type KMLGeometry. Example
Dim G As KMLGeometry Dim Poly As KMLPolygon Poly.GetGeometry G
KMLPolygon
Page 106-2
Properties
Methods
Properties
NrOfCutouts Returns
Long
Description This property returns the number of cutouts (= holes) in the inner boundary. Example
Dim Inner As KMLInnerBoundary Dim NrHoles As Long NrHoles = Inner.NrOfCutouts
IsEmpty Returns
Boolean
Iterator Returns
KMLInnerBoundaryIterator
Description This property returns an iterator that allows to traverse a list of KMLCoordinates. Example
Dim Inner As KMLInnerBoundary Dim InnerIterator As KMLInnerBoundaryIterator InnerIterator = Inner.Iterator
KMLInnerBoundary
Page 107-1
Methods
Add Parameters
Coord As KMLCoordinates
Description This method ads a KMLCoordinates object (a cut out) to the inner boundary. The object is added at the end of the list. Example
Dim Dim Dim ' For Inner As KMLInnerBoundary C As KMLCoordinates i As Integer
Clear Parameters
None
Description This method makes the inner boundary empty. Result: NrOfCutouts = 0 IsEmpty = True Example
Dim Inner As KMLInnerBoundary Inner.Clear
KMLInnerBoundary
Page 107-2
Set Inner = New KMLInnerBoundary '.... Set Iter = Inner.Iterator '.... If Iter.Valid = False Then Exit Sub End If First = True While Not Iter.EndOfList If First Then Iter.GetFirst CutOut First = False Else Iter.GetNext CutOut End If Wend
Properties
Methods
Properties
Valid Returns
Boolean
Description This property returns true if the iterator is valid. An iterator may become invalid if the methods Insert or Remove are used by another iterator of the same KMLInnerBoundary. Example
Dim Iterator As KMLInnerBoundaryIterator If Iterator.Valid Then '... End If
EndOfList Returns
Boolean
KMLInnerBoundaryIterator
Page 108-1
Description This property returns true if the iterator is at the end of the list. Example
Dim Iterator As KMLInnerBoundary While Not Iterator.EndOfList '.... Wend
Methods
GetFirst Parameters
CutOut As KMLCoordinates
Description This method returns the first KMLCoordinates object (a cut out) from the inner boundary. Example
Dim Iter As KMLInnerBoundaryIterator Dim CutOut As KMLCoordinates Dim First As Boolean First = True While Not Iter.EndOfList If First Then Iter.GetFirst CutOut First = False Else Iter.GetNext CutOut End If Wend
GetNext Parameters
CutOut As KMLCoordinates
Description This method returns the next KMLCoordinates object (a cut out) from the inner boundary. Example
See GetFirst
Insert Parameters
CutOut As KMLCoordinates, Position As Long
Description This method inserts a KMLCoordinates object (a cut out) at the given position. Position has one of the following values: ptBegin, ptEnd, ptBefore, or ptAfter. ptBegin and ptEnd insert respectively at the start or the end of the list. ptBefore and ptAfterinsert before or after the current position in the list. The current position is changed by the methods GetFirst and GetNext. After Insert, the current position will point to the inserted element. Example
Dim Iter As KMLInnerBoundaryIterator Dim CutOut As KMLCoordinates Iter.Insert CutOut, ptBegin
KMLInnerBoundaryIterator
Page 108-2
Remove Parameters
CutOut As KMLCoordinates
Description This method removes a cutout defined by its KMLCoordinates from the inner boundary. Example
Dim Iter As KMLInnerBoundaryIterator Dim CutOut As KMLCoordinates Iter.Remove CutOut
KMLInnerBoundaryIterator
Page 108-3
Properties
Methods
Properties
NrOfCoordinates Returns
Number As Long
Description This property returns the number of coordinates in the list. Example
Dim Coords As KMLCoordinates Dim Nr As Long Nr = Coords.NrOfCoordinates
IsEmpty Returns
Boolean
Iterator Returns
KMLCoordinatesIterator
Description This property returns an iterator that allows to traverse a list of KMLCoordinates. Example
Dim Coords As KMLCoordinates Dim Iter As KMLCoordinatesIterator Iter = Coords.Iterator
KMLCoordinates
Page 109-4
Methods
Add Parameters
Coord As KMLCoordinates
Description This method ads a KMLCoordinate object to the list. The object is added at the end of the list. The object is added by reference. Example
Dim Dim Dim ' For Coords As KMLCoordinates C As KMLCoordinate i As Integer
Clear Parameters
None
Description This method clears the list. Result: NrOfCoordinates = 0 IsEmpty = True Example
Dim Coords As KMLCoordinates Coords.Clear
KMLCoordinates
Page 109-5
Set Coords = New KMLCoordinates '.... Set Iter = Coords.Iterator '.... If Iter.Valid = False Then Exit Sub End If First = True While Not Iter.EndOfList If First Then Iter.GetFirst C First = False Else Iter.GetNext C End If Wend
Properties
Methods
Properties
Valid Returns
Boolean
Description This property returns true if the iterator is valid. An iterator may become invalid if the methods Insert or Remove are used by another iterator obtained from the same KMLCoordinates object. Example
Dim Iterator As KMLCoordinatesIterator If Iterator.Valid Then '... End If
EndOfList Returns
Boolean
KMLCoordinatesIterator
Page 110-1
Description This property returns true if the iterator is at the end of the list. Example
Dim Iterator As KMLCoordinates While Not Iterator.EndOfList '.... Wend
Methods
GetFirst Parameters
C As KMLCoordinate
GetNext Parameters
C As KMLCoordinate
Insert Parameters
C As KMLCoordinate, Position As Long
Description This method inserts a KMLCoordinate object at the given position. Position has one of the following values: ptBegin, ptEnd, ptBefore, or ptAfter. ptBegin and ptEnd insert respectively at the start or the end of the list. ptBefore and ptAfterinsert before or after the current position in the list. The current position is changed by the methods GetFirst and GetNext. After Insert, the current position will point to the inserted element. Example
Dim Iter As KMLCoordinatesIterator Dim C As KMLCoordinate Iter.Insert C, ptBegin
KMLCoordinatesIterator
Page 110-2
Remove Parameters
C As KMLCoordinate
Description This method removes the coordinate specified by the argument from the list. Example
Dim C As KMLCoordinate Dim Iter As KMLCoordinatesIterator Iter.GetFirst C If SomeCondition(C) Then Iter.Remove C End If
KMLCoordinatesIterator
Page 110-3
Properties
GeoPoint Returns
KMLGeoPoint
Description This property returns or sets the coordinates of a KML point Example
Dim P As KMLGeoPoint Dim C As KMLCoordinate P.Longitude = 30.5 P.Latitude = 50.5 P.Altitude = 0.0 C.GeoPoint = P ' P = C.GeoPoint
KMLCoordinate
Page 111-1
Properties
UnitOfLength AngleUnit HorizontalAngleClockwise VertAngleType XYZRepresentation RectangleCoordRepr ScaleFormat ChainageFormat DecimalSeparator ItemSeparator DecimalPlacesForAngles DecimalPlacesForLengths DecimalPlacesForXYCoords DecimalPlacesForAreas DecimalPlacesForVolumes LongDateFormat ShortDateFormat
Units
Page 112-1
Methods
SetTransformation GetTransformation ConvertCoordinatesToUser ConvertCoordinatesToInternal ConvertLengthToUser ConvertLengthToInternal ConvertAngleToUser ConvertAngleToInternal ConvertAreaToUser ConvertAreaToInternal ConvertVolumeToUser ConvertVolumeToInternal StrConvertCoordinatesToUser StrConvertCoordinatesToInternal StrConvertLengthToUser StrConvertLengthToInternal StrConvertChainageToUser StrConvertAngleToUser StrConvertAngleToInternal StrConvertAreaToUser StrConvertAreaToInternal StrConvertVolumeToUser StrConvertVolumeToInternal FormatLongDate FormatShortDate FormatTime StringToDateTime StringToDate StringToTime StringToDateTime GetPreferences SetPreferences
Properties
UnitOfLength Returns
Integer
Description Returns or sets the unit of length used by the conversion methods. The unit of length must be one of the following values : ptMM, ptCM, ptDM, ptM, ptDAM, ptHM, ptKM, ptInch, ptMiles, ptFeet, ptUSfeet. Example
Dim U As Units U.UnitOfLength = ptUSfeet
AngleUnit Returns
Integer
Description Returns or sets the angle used by the conversion methods. The angle unit must be one of the following values : ptGRAD, ptDEGdec, ptDEGMinSec, ptMIL, ptSURVEY, ptRADIAN . Example
Dim U As Units
Units
Page 112-2
U.AngleUnit = ptSURVEY
HorizontalAngleClockwise Returns
Boolean
VertAngleType Returns
Integer
Description Returns or sets the type of vertical angle used by the conversion methods. The vertical angle type must have one of the following values : ptVALevel, ptVA90, ptVA270. Example
Dim U As Units U.VertAngleType = ptVA90
XYZRepresentation Returns
Integer
Description Returns or sets the meaning of X,Y,Z used by the conversion methods. The XYZ Representation must be one of the following values : ptRectangular, ptPolar, ptHVD, ptHVS. Example
Dim U As Units U.XYZRepresentation = ptHVS
RectangleCoordRepr Returns
Integer
Description Returns or sets the meaning of the rectangular coordinates. RectangleCoordRepr must have one of the following values : ptMathmaticalXY, ptNorthEast, ptGermanYX, ptUserDefined . Example
Dim U As Units U.RectangleCoordRepr = ptNorthEast
ScaleFormat Returns
Integer
Description Returns or sets the scale format to either the metric or imperial standard. ScaleFormat must have one of the following values : ptScaleMetric, ptScaleImperial. Example
Dim U As Units Set U = New Units
Units
Page 112-3
ChainageFormat Returns
Integer
Description Returns or sets the format used in converting a chainage to a string. ChainageFormat must have one of the following values : ptChainageFormatNormal, ptChainageFormatPlus . Example
Dim U As Units Set U = New Units U.GetPreferences U.ChainageFormat = ptChainageFormatPlus U.SetPreferences
DecimalSeparator Returns
Byte
Description Returns or sets the decimal separator. The value is either "," (comma) or "." (point). When another value is attempted to be assigned an exception is raised. When this and ItemSeparator properties become both , then value of ItemSeparator is changed to ;. Example
Dim U As Units U.DecimalSeparator = Asc(",")
ItemSeparator Returns
Byte
Description Returns or sets the item separator. An item separator is used when representing a list of items. The value is either "," (comma) or ";" (semicol). When another value is attempted to be assigned an exception is raised. When this and DecimalSeparator properties become both , then value of DecimalSeparator is changed to .. Example
Dim U As Units U.ItemSeparator = Asc(";")
DecimalPlacesForAngles Returns
Integer
Description Returns or sets the number of decimal places when an angle is converted to a string. The value must be in the range 0 to 5. Example
Dim U As Units U.DecimalPlacesForAngles = 5
DecimalPlacesForLengths Returns
Integer Page 112-4
Units
Description Returns or sets the number of decimal places when a distance is converted to a string. The value must be in the range 0 to 5. Example
Dim U As Units U.DecimalPlacesForLengths = 2
DecimalPlacesForXYCoords Returns
Integer
Description Returns or sets the number of decimal places when coordinates (X,Y) are converted to strings. The value must be in the range 0 to 5. Example
Dim U As Units U.DecimalPlacesForXYCoords = 3
DecimalPlacesForAreas Returns
Integer
Description Returns or sets the number of decimal places when an area is converted to a string. The value must be in the range 0 to 5. Example
Dim U As Units U.DecimalPlacesForAreas = 1
DecimalPlacesForVolumes Returns
Integer
Description Returns or sets the number of decimal places when an volume is converted to a string. The value must be in the range 0 to 5. Example
Dim U As Units U.DecimalPlacesForVolumes = 0
LongDateFormat Returns
String
Description Returns or sets the string used for conversion of a date to a string. The following ICU format designations may be used : y Year a a 1-digit number (0 - 9) yy Year as a 2-digit number(00 - 99) yyyy Year as a 4-digit number(100 - 9999) M Number of the month (1 - 12) MM Number of the month (01 - 12) MMM Abreviated name of the month (Jan - Dec) MMMM Full name of the month (January - December) d Day of the month (1 - 31) dd Day of the month (01 - 31) D Day of the year (1 - 366)
Units
Page 112-5
Day of the year (001 - 366) Abbreviated name of the day of the week (Sun - Sat) Full name of the day of the week (Sunday - Saturday)
ShortDateFormat Returns
String
Description ShortDateFormat returns or sets the string used for conversion of a "short date" string to a date. The following ICU format designations may be used (this is a subset of the format designations of LongDateFormat : yy Year as a 2-digit number(00 - 99) yyyy Year as a 4-digit number(100 - 9999) M Number of the month (1 - 12) MM Number of the month (01 - 12) d Day of the month (1 - 31) dd Day of the month (01 - 31) Notes: - The 3 elements day, month and yearmust be present, and only once. - The designators must be separated by at least one character. Example
Dim U As Units U.ShortDateFormat = "yy-mm-dd"
TimeFormat Returns
String
Description Returns or sets the string used for conversion of the time to a string or vice versa. The following ICU format designations may be used : h Hour of the day AM/PM (1 - 12) hh Hour of the day AM/PM (01 - 12) H Hour of the day (0 - 23) HH Hour of the day (00 - 23) m Minute of the hour (0 - 59) mm Minute of the hour (00 - 59) s Second of the minute (0 - 59) ss Second of the minute (00 - 59) S Millisecond of second (0 - 999) SSS Millisecond of second (000 - 999) a AM/PM marker (AM/PM) Notes: - Hours and minutesmust be present, and only once. - Second designator may be used only once. - Milisecond designator may only be used together with second designator and be used only once. - AM/FM designator may only be used with 12 hour designator (h). - All designators except AM/FM must be separated at least by one character. Example
Dim U As Units U.TimeFormat = "hh-mm-ss"
Units
Page 112-6
AM Returns
String
Description Returns or sets the string used for AM (Ante Meridium) : Example
Dim U As Units U.AM = "am"
PM Returns
String
Description Returns or sets the string used for PM (Post Meridium) : Example
Dim U As Units U.PM = "pm"
ValidLongDateFormat Returns
Boolean
Description Returns true if the long date format string in the current class is a valid date string. Example
Dim U As Units If U.ValidLongDateFormat Then End If
ValidShortDateFormat Returns
Boolean
Description Returns true if the short date format string in the current class is a valid date string. Example
Dim U As Units If U.ValidShortDateFormat Then End If
ValidTimeFormat Returns
Boolean
Description Returns true if the time format string in the current class is a valid time string. Example
Dim U As Units If U.ValidTimeFormat Then
DateTimeFixedLength Returns
Boolean
Units
Page 112-7
Description If set True, the number of digits in the input string of the methods StringToDateTime, StringToDate and StringToTime must exactly match the number of digits specified in the format string. The format string is defined by the property ShortDateFormat or TimeFormat. This property is by default = False. It must only be set if the format string contains no separators (see example). Example
Dim U As Units U.ShortDateFormat = "yyyyMMdd" U.DateTimeFixedLength = True
MaximumYear Returns
Integer
Description Returns are sets the value used to convert a string to a date and only two digits of the year are specified. A year is chosen in the range : MaximumYear - 99 .. MaximumYear. Example
Dim U As Units If U.ValidTimeFormat Then End If
Methods
SetTransformation Parameters
TrPars As Transformation
Description Sets the transformation parameters. The transformation parameters are used by the conversion routines to execute a transformation on the input coordinates. Note that Fi must be given in radians, and that D must be given in meter. The transformation parameters of a coordinate system can be obtained (see object CoordinateSystem property TransformationParameters). This allows to use the methods further described in this section to convert local coordinates from and to coordinates in the respective coordinate system. The meaning of the transformation parameters is made clear by the following illustration:
Units
Page 112-8
Example
GetTransformation Parameters
TrPars As Transformation
ConvertCoordinatesToUser Parameters
Pnt As XYZ, C1 As Double, C2 As Double, C3 As Double
Description Converts coordinates (Pnt) from internal (meter) to new coordinates (C1, C2, C3) taking into account the UnitOfLength, XYZrepresentation (XYZ, HDZ, HVD or HVS), RectangleCoordRepr and the transformation.
Units
Page 112-9
Sequence of the operations to calculate C1, C2 and C3: 1. Transformation 1.1. Translation 1.2. Rotation 1.3. Scaling 2. Conversion to XYZ representation 3. Conversion of units (unit of length, angle unit) Example
' Conversion of rectangular to polar coordinates (HVS) Dim U As Units Dim P As XYZ Dim H As Double, V As Double, S As Double Set U = New Units U.XYZRepresentation = ptHVS U.AngleUnit = ptDegMinSec P.x = 20.0 P.y = 30.0 P.z = 0.0 U.ConvertCoordinatesToUser P, H, V, S
ConvertCoordinatesToInternal Parameters
C1 As Double, C2 As Double, C3 As Double, Pnt As XYZ
Description The inverse transformation of ConvertCoordinatesToUser. Converts coordinates ( C1, C2, C3) whose meaning is defined by the settings in Units namely : UnitOfLength, XYZrepresentation (XYZ, HDZ, HVD or HVS), RectangleCoordRepr and the transformation, to a coordinate (Pnt). Sequence of the operations to calculate Pnt starting from C1, C2 and C3: 1. Conversion of units (unit of length, angle unit) 2. Conversion to XYZ 3. Inverse Transformation 3.1. Scaling 3.2. Rotation 3.3. Translation It is obvious that the result of ConvertCoordinatesToInternal must be equal to the input of ConvertCoordinatesToUser, when the output of ConvertCoordinatesToUser is used as input for ConvertCoordinatesToInternal. See also next example. Example
' Conversion of rectangular to polar coordinates (HVS) Dim U As Units Dim P As XYZ Dim H As Double, V As Double, S As Double Set U = New Units U.XYZRepresentation = ptHVS U.AngleUnit = ptDegMinSec P.x = 20.0 P.y = 30.0 P.z = 0.0 U.ConvertCoordinatesToUser P, H, V, S ' Result H=326.18, V=0.0, S=36.05 U.ConvertCoordinatesToInternal H, V, S, P ' Result P = (20.0, 30.0, 0.0)
ConvertLengthToUser Parameters
In As Double, Out As Double
Units
Page 112-10
Description Converts a length, given by parameter In, from its internal value (meter) to a length in units, defined by UnitOfLenth. Example
Dim U As Units Dim DMeter As Double, DFeet As Double Set U = New Units U.UnitOfLength = ptFeet U.ConvertLengthToUser 1.0, DFeet U.ConvertLengthToInternal DFeet, DMeter
ConvertLengthToInternal Parameters
In As Double, Out As Double
ConvertAngleToUser Parameters
In As Double, AngleType As Integer, Out As Double
Description Converts an angle, parameter In, from its internal value (radians) to an angle in units defined by AngleUnit. AngleType must have one of the following values ptHorAngle, ptVertAngle, ptArcAngle, ptBearingAngle. If AngleType<>ptArcAngle, then an extra conversion will be done on the angle depending on the setting of HorizontalAngleClockwise or VertAngleType. Example
Dim Dim Dim Dim U As Units Bearing As Double A As Integer Out As Double
Set U = New Units U.AngleUnit = ptSURVEY U.ConvertAngleToUser 0.0, ptBearingAngle, Bearing U.ConvertAngleToInternal Bearing, A, Out
ConvertAngleToInternal Parameters
In As Double, AngleType As Integer, Out As Double
ConvertAreaToUser Parameters
In As Double, Out As Double
Description Converts an area, given by parameter In, from its internal value (square meter) to the area in the units defined by UnitOfLenth. Units
Page 112-11
Example
Dim U As Units Dim AreaInternal As Double, AreaSqFeet As Double Set U = New Units U.UnitOfLength = ptFeet U.ConvertAreaToUser 2500.0, AreaSqFeet U.ConvertAreaToInternal AreaSqFeet, AreaInternal
ConvertAreaToInternal Parameters
In As Double, Out As Double
ConvertVolumeToUser Parameters
In As Double, Out As Double
Description Converts a volume, given by parameter In, from its internal value (cubic meter) to the volume in the units defined by UnitOfLenth. Example
Dim U As Units Dim VolumeInternal As Double, VolumeCubicFeet As Double Set U = New Units U.UnitOfLength = ptFeet U.ConvertVolumeToUser 25000.0, VolumeCubicFeet U.ConvertVolumeToInternal VolumeCubicFeet, VolumeInternal
ConvertVolumeToInternal Parameters
In As Double, Out As Double
StrConvertCoordinatesToUser Parameters
Pnt As XYZ, C1 As String, C2 As String, C3 As String
Description Converts coordinates (Pnt) from internal (meter) to new coordinates (C1, C2, C3) taking into account the UnitOfLength, XYZrepresentation (XYZ, HDZ, HVD or HVS), RectangleCoordRepr and the transformation. The result is identical to the one obtained from ConvertCoordinatesToUser with the exception that the results (C1, C2, C3) are strings. The number of decimal places in the result is defined by DecimalPlacesForLengths. Sequence of the operations : see ConvertCoordinatesToUser Example
' Conversion of rectangular to polar coordinates (HVS) Dim U As Units
Units
Page 112-12
Dim P As XYZ Dim HStr As String, VStr As String, SStr As String Set U = New Units U.XYZRepresentation = ptHVS U.AngleUnit = ptDegMinSec P.x = 20.0 P.y = 30.0 P.z = 0.0 U.StrConvertCoordinatesToUser P, HStr, VStr, SStr
StrConvertCoordinatesToInternal Parameters
C1 As String, C2 As String, C3 As String, Pnt As XYZ
Description The inverse transformation of ConvertCoordinatesToUser. Converts coordinates ( C1, C2, C3) whose meaning is defined by the settings in Units namely : UnitOfLength, XYZrepresentation (XYZ, HDZ, HVD or HVS), RectangleCoordRepr and the transformation, to a coordinate (Pnt). StrConvertCoordinatesToInternal will mainly be used to transform input data to a coordinate for insertion in the drawing. Sequence of the operations : see ConvertCoordinatesToUser. It is obvious that the result of StrConvertCoordinatesToInternal must be equal to the input of StrConvertCoordinatesToUser, when the output of StrConvertCoordinatesToUser is used as input for StrConvertCoordinatesToInternal. See also next example. Example
' Conversion of polar (HVS) to rectangular coordinates Dim U As Units Dim P As XYZ Dim HStr As String, VStr As String, SStr As String Set U = New Units U.XYZRepresentation = ptHVS U.AngleUnit = ptDegMinSec P.x = 20.0 P.y = 30.0 P.z = 0.0 U.StrConvertCoordinatesToUser P, HStr, VStr, SStr U.StrConvertCoordinatesToInternal HStr, VStr, SStr, P
StrConvertLengthToUser Parameters
In As Double, Out As String
Description Converts a length, given by parameter In, from its internal value (meter) to a length in units, defined by UnitOfLenth. This method is identical to ConvertLengthToUser with this exception that the result is a string. Example
Dim U As Units Dim DMeter As Double, DFeet As String Set U = New Units U.UnitOfLength = ptFeet U.StrConvertLengthToUser 1.0, DFeet U.StrConvertLengthToInternal DFeet, DMeter
Units
Page 112-13
StrConvertLengthToInternal Parameters
In As String, Out As Double
StrConvertChainageToUser Parameters
In As Double, Out As String
Description Converts a length, given by parameter In, from its internal value (meter) to a length in units, defined by UnitOfLenth and using the ChainageFormat. Example
Dim U As Units Dim Chainage As Double Dim S As String Set U = New Units U.UnitOfLength = ptMeter U.ChainageFormat = ptChainageFormatPlus U.StrConvertChainageToUser Chainage, S
StrConvertAngleToUser Parameters
In As Double, AngleType As Integer, Out As String
Description Converts an angle, parameter In, from its internal value (radians) to an angle in units defined by AngleUnit. AngleType must have one of the following values ptHorAngle, ptVertAngle, ptArcAngle, ptBearingAngle. If AngleType<>ptArcAngle, then an extra conversion will be done on the angle depending on the setting of HorizontalAngleClockwise or VertAngleType. This method is identical to ConvertAngleToUser with this exception that the result is a string. Example
Dim U As Units Dim A As Double, Bearing As String Set U = New Units U.AngleUnit = ptDegMinSec U.StrConvertAngleToUser 0.0, ptBearingAngle, Bearing U.StrConvertAngleToInternal Bearing, ptBearingAngle, A
StrConvertAngleToInternal Parameters
In As String, AngleType As Integer, Out As Double
StrConvertAreaToUser Parameters
In As Double, Out As String.
Units
Page 112-14
Description Converts an area, given by parameter In, from its internal value (square meter) to the area in the units defined by UnitOfLenth. This method is identical to ConvertAreaToUser with this exception that the result is a string. Example
Dim U As Units Dim AreaInternal As Double, AreaSqFeet As String Set U = New Units U.UnitOfLength = ptFeet U.StrConvertAreaToUser 2500.0, AreaSqFeet U.StrConvertAreaToInternal AreaSqFeet, AreaInternal
StrConvertAreaToInternal Parameters
In As String, Out As Double
StrConvertVolumeToUser Parameters
In As Double, Out As String
Description Converts a volume, given by parameter In, from its internal value (cubic meter) to the volume in the units defined by UnitOfLenth. This method is identical to ConvertVolumeToUser with this exception that the result is a string. Example
Dim U As Units Dim VolumeInternal As Double, VolumeCubicFeet As String Set U = New Units U.UnitOfLength = ptFeet U.StrConvertVolumeToUser 25000.0, VolumeCubicFeet U.StrConvertVolumeToInternal VolumeCubicFeet, VolumeInternal
StrConvertVolumeToInternal Parameters
In As String, Out As Double
Description Converts the date given by the parameter D to a string. The format corresponds with the setting of the property LongDateFormat. If the format is invalid the string "?????" will be returned.
Units
Page 112-15
Example
Description Converts the date given by the parameter D to a string. The format corresponds with the setting of the property ShortDateFormat. If the format is invalid the string "?????" will be returned. Example
Dim U As Units MsgBox U.FormatShortDate(Date)
Description Converts the time given by the parameter T to a string. The format corresponds with the setting of the property TimeFormat. If the format is invalid the string "?????" will be returned. Example
Dim U As Units MsgBox U.FormatTime(Time)
Description Converts the string containing date and time to a date. The setting of the property ShortDateFormat and ShortTimeFormat are used. If the format is an invalid date/time string, Error value is returned. Example
Dim U As Units Dim D As Date D = U.StringToDateTime("25-09-1946 05:00") If IsError(D) Then ' Invalid date/time string End If
Units
Page 112-16
Description Converts the string to a date. The setting of the property ShortDateFormat is used. If the format is an invalid date string, Error value is returned. Example
Dim U As Units Dim D As Date D = U.StringToDate("25-09-1946")
Description Converts the string to a date. The setting of the property TimeFormat is used. If the format is an invalid date string, Error is returned. Example
Dim U As Units Dim D As Date D = U.StringToTime("10am")
GetPreferences Parameters
None
Description Sets the units to the preferences set in the Defaults, Preferences dialog. Regarding decimal places, the number of decimal places for annotations is taken. Example
Dim U As Units Set U = New Units U.GetPreferences
SetPreferences Parameters
None
Description Sets the the preferences (see Defaults, Preferences dialog) to the values stored in the object Units. Regarding decimal places : only the number of decimal places for annotations can be changed with this method. Example
U.SetPreferences ' Preferences of user are changed to values in object
Units
Page 112-17
Set C = New COMM C.Port = "COM1" C.Baudrate = 9600 C.Parity = ptNoParity C.NrOfBits = 8 C.StopBits = ptStopbit1 C.Handshaking = ptNoFlowControl C.OpenLink ptCommReadaccess, Ok If Ok THEN Nr = 0 ReDim Data(1 to 200) C.Read 200, Data, Nr ' etc. End If
Properties
Baudrate Stopbits Parity Handshaking NrOfBits Port OpenLink CloseLink Read Write ClearInputBuffer
Methods
Properties
Baudrate Returns
Long
Description Returns or sets the baudrate of the serial port. Baudrate must have one of the following values : 110, 220, 300, 1200, 4800, 9600, 19200, 38400, 57600, 115200, 128000, 256000 or 19200. Example
Dim C As Comm C.Baudrate = 9600
StopBits Returns
Long
Description Returns or sets the number of stop bits. StopBits must have one of the following values : ptStopBit1, ptStopbit1_5, ptStopbit2 Comm
Page 113-1
Example
Parity Returns
Long
Description Returns or sets the parity. Parity must have one of the following values : ptNoParity, ptOddParity, ptEvenParity, ptMarkParity, ptSpaceParity . Example
Dim C As Comm C.Parity = ptNoParity
HandShaking Returns
Long
Description Returns or sets the handshaking protocol. HandShaking must have one of the following values : ptXonXoff, ptHardware, ptNoFlowControl. Example
Dim C As Comm C.HandShaking = ptHardware
NrOfBits Returns
Long
Description Returns or sets the number of bits per byte. The value must be in the range 4 to 8. Normally this value = 8. Example
Dim C As Comm C.NrOfBits = 8
Port Returns
String
Description Returns or sets the communication port that will be used for the serial communication. The name of the communication port starts with "COM" followed by the digit 1, 2, 3 or 4. Most computers have 1 or 2 communication ports named COM1 and COM2. Example
Dim C As Comm C.Port = "COM1"
Methods
OpenLink Parameters
Access As Integer, Ok As Boolean
Comm
Page 113-2
Description OpenLink opens the communication port using the parameters Baudrate, Parity, NrOfBits, StopBits, HandShaking. The parameter Access must have one of the following values : ptCommReadAccess, ptCommWriteAccess or ptCommReadWriteAccess. If the communication link is opened, Ok returns True. Example
Dim Dim Dim Dim C As COMM Nr As LONG Data() As BYTE Ok As Boolean
Set C = New COMM C.Port = "COM1" C.Baudrate = 9600 C.Parity = ptNoParity C.NrOfBits = 8 C.StopBits = ptStopbit1 C.Handshaking = ptNoFlowControl C.OpenLink ptCommReadAccess, Ok
CloseLink Parameters
None
Read Parameters
NrOfBytes As Long, Data() As Byte, NrOfBytesRead As Long
Description The method Read, reads data which is in the input buffer of the serial port. The dynamic array Data must be large enough to read the number of bytes requested ( NrOfBytes). The real number of bytes read is returned in the parameter NrOfBytesRead. Example
Dim Dim Dim Dim C As COMM Nr As LONG Data() As BYTE Ok As Boolean
Set C = New COMM C.Port = "COM1" C.Baudrate = 9600 C.Parity = ptNoParity C.NrOfBits = 8 C.StopBits = ptStopbit1 C.Handshaking = ptNoFlowControl C.OpenLink ptCommReadaccess, Ok If Ok THEN Nr = 0 ReDim Data(1 to 200) C.Read 200, Data, Nr ' etc. End If
Comm
Page 113-3
Write Parameters
NrOfBytes As Long, Data() As Byte, NrOfBytesWritten As Long
Description The method Write, writes data to the serial port. The dynamic array Data must be large enough to read the number of bytes requested (NrOfBytes). The real number of bytes read is returned in the parameter NrOfBytesRead. Example
Dim Dim Dim Dim Dim Dim C As Comm Data() As Byte j As Long Nr As Long T As String s As String
ReDim Data(1 to Len(s)) for j = 1 to Len(s) t = Mid(s, j, 1) Data(j) = Cbyte(Asc(t)) next j C.Write Len(s), Data, Nr
ClearInputBuffer Parameters
None
Description ClearInputBuffer, empties the input buffer of the serial port. Example
Dim C As Comm C.ClearInputBuffer
Comm
Page 113-4
' Interval = 2.0 sec ' Name of the macro to be called every 2 seconds
Properties
Methods
Properties
ElapsedTime Returns
Long
Description Returns the time in milliseconds since the timer is started. Example
Dim T As Timer If T.ElapsedTime > 100000 Then MsgBox "wake up" End If ' Must be declared globally
Interval Returns
Long
Description Returns or sets the timer interval. When the Interval time is elapsed, the callback macro will be executed. The timer interval is expressed in milliseconds. Example
Dim T As Timer Set T = New Timer T.Interval = 10000 T.CallBackMacro = "CallMe" ' Must be declared globally
CallBackMacro Returns
String
Timer
Page 114-1
Description Returns or sets the name of the macro which is executed when the timer interval is elapsed. Example
Dim T As Timer Set T = New Timer T.Interval = 10000 T.CallBackMacro = "CallMe" T.Start ' Must be declared globally
Methods
Start Parameters
None
Description Starts the timer. Only when the timer has been started the call back macro will be executed and the elapsed time will start to run. Example
Dim T As Timer Set T = New Timer T.Interval = 10000 T.CallBackMacro = "CallMe" T.Start ' Must be declared globally
' Macro "CallMe" to be called every 10 seconds ' This starts the timer
Stop Parameters
None
Description Stops the timer. The timer object still exists, but the timer stops to run and the call back macro will not be called again. Destroying the object (Set T = Nothing) would also stop the timer. Example
Dim T As Timer T.Stop ' Must be declared globally ' Stop calling CallMe.
Timer
Page 114-2
' Progress dialog with Cancel button ' Name of the macro to be called every 2 seconds P.Message = "Part 1/2 : reading data from disk" P.Start ' Dialog box will appear Do Until (I >= NrOfObjects) OR P.Cancelled P.Percentage = CDBL(I * 100 / NrOfObjects) ' .... Loop P.Stop
Properties
Methods
Properties
CancelButton Returns
Boolean
Description This property should be called before calling the method Start. When set = True, the dialog box gets a Cancel button. By default the progress dialog has no cancel button. When the property is called when the dialog box is displayed, this has no effect. Example
Dim P As Progress Set P = New Progress P.CancelButton = True
Message Returns
String
Description Returns or sets the message displayed in the progress dialog box. Example
Dim P As Progress Set P = New Progress P.Message = "Part 2/2 : building Pythagoras drawing"
Progress
Page 115-1
Title Returns
String
Description Returns or sets the title of the progress dialog box. Example
Dim P As Progress Set P = New Progress P.Title = "Importing data"
Percentage Returns
Double
Description Returns or sets the progress. Percentage should be a value between 0.0 and 100.0. The value indicates the ratio of the progress bar. Example
Dim P As Progress Set P = New Progress P.Start P.Percentage = 15.0
Cancelled Returns
Boolean
Description Returns True if the Cancel button has been pressed. A macro will NOT be interrupted when the Cancel button is pressed. A macro should call the Cancelled property frequently to allow a fast response when the user presses the Cancel button. Example
Dim P As Progress Set P = New Progress P.Title = "Importing data" P.Message = "Still importing..." P.Start If P.Cancelled Then P.Stop End If
Methods
Start Parameters
None
Progress
Page 115-2
Stop Parameters
None
Description Removes the progress dialog box from the screen. Example
Dim P As Progress P.Stop
Progress
Page 115-3
Properties Methods
Properties
NrOfFonts Returns
Long
Description This property returns the number of fonts in the system. Example
Dim Fnts As Fonts Set Fnts = New Fonts MsgBox CStr(Fnts.NrOfFonts)
Methods
GetFirst Parameters
None
GetNext Parameters
None
Fonts
Page 116-1
Properties
Methods
Properties
NrOfFolders Returns
Long
Description This property returns the number of folders in the folder. Example
Dim F As Folder Set F = New Folder F.Assign "C:\TestPrograms\VBA\" MsgBox CStr(F.NrOfFolders)
NrOfFiles Returns
Long
Description This property returns the number of files, not including folders, in the folder.
Folder
Page 117-1
Example
Path Returns
String
Description This property returns the path name of the folder. Example
Set F = New Folder F.Assign "C:\TestPrograms\VBA\" MsgBox F.Path 'Returns "C:\TestPrograms\VBA\"
Methods
Assign Parameters
String
FirstFolder Parameters
Folder
Description Returns the first folder in the given folder. If the folder contains no other folders, the method returns Nothing. Example
See introduction
NextFolder Parameters
None
FirstFile Parameters
File
Description Returns the first file in the given folder. If the folder contains no other files, the method returns Nothing. Example
See introduction
Folder
Page 117-2
NextFile Parameters
File
Description Returns the next file in the given folder. If the folder contains no other files, the method returns Nothing. Example
See introduction
Folder
Page 117-3
Properties
Methods
Properties
Drive Returns
String
Path Returns
String
File
Page 118-1
Name Returns
String
Extention Returns
String
FullName Returns
String
FileType Returns
String
Application Returns
String
Description This property returns the name of the application (full path name) to open the file. Example
Dim F As File Set F = New File
File
Page 118-2
Methods
Assign Parameters
String
File
Page 118-3
Methods
Methods
Connect Parameters
DataSource As String, UserId As String, PassWord As String, Error As Integer, ErrorStr As String
Description Connects with the database. The parameter DataSource is the name of the ODBC User data source. That name is given with the standard MS Windows tool "ODBC Data Source Administrator" . Once this call is successfully excecuted, the VBA program can access the database. When a connection with a database is made, Pythagoras stores internally a number of handles that are used to access the database. When the ODBCDataSource object is released, either implicitly by the compiler when the Object variable is released or explicitly with the statement Set DB = Nothing, all ODBC statements to disconnect and to free memory are called by Pythagoras VBA environment. This method calls the function SQLConnect of the ODBC32.DLL.
ODBCDataSource
Page 119-1
The parameters Error and ErrorStr are return parameters. These values are as defined by the ODBC interface standard. Example
Const SQL_SUCCESS = 0 Dim DB As ODBCDataSource Dim Err As Integer, StrError As String Dim DataBaseName As String Set DB = New ODBCDataSource DataBaseName = "Parcels" DB.Connect DataBaseName, "admin", "", Err, StrError If Err <> SQL_SUCCESS Then MsgBox "error connect" SET DB = Nothing End If
Select Parameters
SQLStr As String, Error As Integer
Description The Select method sends the Select statement with the parameter SQLStr to the database. The meaning of the return parameter Erroris defined by the ODBC interface standard. This method calls the function SQLExecDirect of the ODBC32.DLL. The parameter Error is a return parameter. Example
Const SQL_SUCCESS = 0 Dim DB As ODBCDataSource Dim Err As Integer Dim SQLStr As String Dim res As Integer Set DB = New ODBCDataSource SQLStr = "SELECT Name FROM Parcel WHERE ParcelNr = 'AB53DZ'" DB.Select SQLStr, res If res <> SQL_SUCCESS Then MsgBox "Parcel not found" Else ' Fetch & Get data End If
Description This method must be called before calling GetData. The method will retrieve the next row and increment the cursor. This method calls the function SQLFetch of the ODBC32.DLL. Example
Dim ODBC As ODBCDataSource If ODBC.FetchNext() Then ' Get data End If
GetData Parameters
ColumnNr As Integer, Data As String, SQLReturn As Integer
ODBCDataSource
Page 119-2
Description Reads the column specified by ColumnNr from the current row and returns the content of the column in the parameter Data. The meaning of the return parameter SQLReturnis defined by the ODBC interface standard. This method calls the function SQLGetData of the ODBC32.DLL. Example
Const SQL_SUCCESS = 0 Dim DB As ODBCDataSource Dim DataStr As String Dim Res As Integer DB.GetData 1, DataStr, Res If Res = SQL_Success Then ' Use data End If
Description This method calls the function SQLCancel of the ODBC32.DLL. The meaning of the return parameter SQLReturnis defined by the ODBC interface standard. Example
Dim DB As ODBCDataSource Dim Res As Integer DB.Cancel Res
FreeStmt Parameters
Option As Integer, SQLReturn As Integer
Description This method calls the function SQLFreeStmt of the ODBC32.DLL. The value of parameter Option is one of the following values : SQL_CLOSE, SQL_DROP, SQL_UNBIND or SQL_RESET_PARAMS. Example
Const SQL_CLOSE = 0 Dim Res As Integer Dim DB As ODBCDataSource DB.FreeStmt SQL_CLOSE, Res
ODBCDataSource
Page 119-3
Properties Methods
Methods
RequestFileOpen Parameters
FileName As String, Title As String, FileType As String, Extension As String, ReadOnly As Boolean, Ok As Boolean
Description Will invoke the standard Windows or Macintosh "Open" dialog. When a file is selected, the complete pathname of the selected file will be returned in the parameter FileName. FileName : if the string <> "", the path will be used to show the files in the corresponding directory. The FileName may contain wild characters ("*" and "?") so that only matching names are displayed in the open dialog box list. Title : the description in the title bar of the dialog. FileType : A description of the type of file. This description comes in the dialog box. Extension : only files with this extension will be shown. On Apple Macintosh : only the extensions TXT and PYT are accepted by this method. As an alternative, the string may contain a valid OSTYPE. E.g. "TIFF", "BMP ", etc. ReadOnly : if = FALSE, only files which can be opened for read/write will be shown. Ok : returns TRUE if a file is selected. Example
Dim Dim Dim Dim A As Application MyDialogs As Dialogs Ok As Boolean FileName As String
Set A = New Application A.GetDialogs MyDialogs FileName = "C:\Dir1\Test" MyDialogs.RequestFileOpen FileName, "My Title", "My Type", "PYT", False, Ok MsgBox "Requested File name : " & FileName
RequestFilesOpen
Parameters
Dialogs
Page 120-1
Path As String, FileNames() As String, Title As String, FileType As String, Extension As String, ReadOnly As Boolean, Ok As Boolean
Description Will invoke the standard Windows or Macintosh "Open" dialog. When one or more files are selected, names of the selected files (without path) will be returned in the parameter FileNames. Path: the path will be used to show the files in the corresponding directory. Title : the description in the title bar of the dialog. FileType : A description of the type of files. This description comes in the dialog box. Extension : only files with this extension will be shown. ReadOnly : if = FALSE, only files which can be opened for read/write will be shown. Ok : returns TRUE if at least a one file is selected. Example
Dim Dim Dim Dim Dim Dim A As Application MyDialogs As Dialogs Ok As Boolean PathName As String FileNames() As String i As Long
Set A = New Application A.GetDialogs MyDialogs FileName = "." MyDialogs.RequestFilesOpen PathName, FileNames, "My Title", "My Type", "PYT", False, Ok MsgBox "Path : " & FileName For i = 0 To UBound(FileNames) MsgBox FileNames(i) Next i
RequestFolderOpen Parameters
Folder As String, Ok As Booleans
Description Will invoke the standard Windows or Macintosh "Open" dialog. In this dialog box, only paths can be selected. Example
Dim Dim Dim Dim A As Application MyDialogs As Dialogs Ok As Boolean Path As String
Set A = New Application A.GetDialogs MyDialogs MyDialogs.RequestFolderOpen Path, Ok If Ok Then MsgBox "Requested folder : " & Path End If
RequestFileSave Parameters
FileName As String, Title As String, FileType As String, Extension As String, Ok As Booleans
Description Will invoke the standard Windows or Macintosh "Save" dialog. On entry, FileName may contain a string. This name will be displayed initially in the dialog box. The complete pathname of the name entered file will be returned in the parameter FileName. FileName : if the string <> "", it must be the path of the directory initially shown. Title : the description in the title bar of the dialog.
Dialogs
Page 120-2
FileType : A description of the type of file. This description comes in the dialog box. Extension : only files with this extension will be shown Ok : returns TRUE if a file is selected. Example
Set A = New Application A.GetDialogs MyDialogs MyDialogs.RequestFileSave FileName, "My Title", "My description", "PYT", Ok If Ok Then MsgBox "Requested File name : " & FileName End If
RequestTextFileView Parameters
FileName As String
Description Opens the ASCII file with the given name with the Pythagoras ASCII editor. Example
Dim A As Application Dim MyDialogs As Dialogs Set A = New Application A.GetDialogs MyDialogs MyDialogs.RequestTextFileView "C:\Test.txt"
GetTrueColor Parameters
Color As RGB, Ok As Boolean
Description Displays a dialog box allowing the user to select a color. If the Ok button is pressed, the selected color is returned. Example
Dim Dim Dim Dim Dim Dim Dim A As Application Doc As Document AllObjs As AllObjects drawing As Overlay Color As RGB Dlgs As Dialogs Ok As BOOLEAN
Set A = New Application Set Dlgs = New Dialogs A.GetActiveDocument Doc If NOT Doc is nothing then Doc.GetOverlay ptDrawing, drawing drawing.GetAllObjects AllObjs Color.Red = 128 Color.Green = 200 Color.Blue = 25 Dlgs.GetTrueColor Color, Ok if Ok then AllObjs.TrueColor = Color end if end if
Dialogs
Page 120-3
' An instance of MyForm will be created and the ' form event MyForm_Initialize will be executed. Form.Show ' Will show the form on the screen. ' This call does not return until the form is ' hidden or unloaded. ' ' Read the required data from the form controls ' e.g. FirstName = Form.FirstName.Value ' Returns the value of the form Textbox FirstName. Set Form = Nothing
Example of a non-modal form Suppose we wish to have a small window displaying the current time of day and being placed always on the top of any other window on the screen. We wish, also, to be able to do any work in Pythagoras, except of loading and compiling macros, while the time is displayed. We can do this by creating a non modal, floating form. First, we create the system macrolibrary, say, CurrentTime. This library will contain two modules: the code module TimeModule and the form module TimeForm. By loading empty TimeModule in Editor and using the command File/New Form we get the empty form module. Rename it as TimeForm using the command File/Modules Manager. The window layout for our form can be created with the command Run/Form. In the from window we create the test label named as Text that will display the current time. We can adjust the size of the form window by moving any corner of the window. Close this window and go to the code of TimeModule. We place the following code in this module:
Dim Form As TimeForm Dim T As Timer Sub TimerCbk Form.Text.Caption = CStr(Time) End Sub Sub PM_CurrentTime Set Form = New TimeForm Form.OpenForm Form.Floating = True TimerCbk Form.Show Set T = New Timer T.Interval = 1000 T.CallBackMacro = "TimerCbk" T.Start End Sub
Form Modules
Page 121-1
Sub OnTermination Set T = Nothing If Not Form Is Nothing Then Form.CloseForm Set Form = Nothing End If End Sub
In this code, we declare the form and the timer objects. The timer call back subroutine TimerCbk just assigns the textual representation of the current time to the form label Text. Subroutine CurrentTime creates the form object, opens the form window, sets this window floating, i.e. topmost, and shows the window on the screen. The subroutine TimerCbk is called to show the initial value of the current time when the window is displayed the first time. Next, the new timer object is created, the interval of 1000 milliseconds is set to call the timer callback subroutine, the name of the timer callback subroutine is set, and, finally, the timer is started. It should be noted, that after the subroutine PM_CurrentTime finishes, form and timer objects declared globally exist until any macrolibrary will be compiled or loaded, or these objects will be destroyed explicitly, e.g. by closing the form and assigning the value of Nothing to corresponding variables. The subroutine OnTermination demonstrates the possibility to specify user actions being executed when this library is deactivated, that is, any macro library is compiled or loaded. The form module TimeForm contains the following code:
Sub TimeForm_Modality(m As Boolean) m = FALSE End Sub Sub TimeForm_QueryClose(Cancel As Boolean, Mode As Integer) Cancel = False OnTermination End Sub
This code processes two events Modality and QueryClose. The subroutine TimeForm_Modality is called when the form object is created to specify the modality of the form. We need a non modal form, so the value of FALSE must be specified. The subroutine TimeForm_QueryClose is called when the form is closed (explicitly, with the call of the form method CloseForm, or implicitly, by clicking on the close button of the form window or when the active library is deactivated). In this subroutine we need to stop the timer and close the form if it is not closed yet, so we just call OnTermination. Events
Initialize Modality Terminate QueryClose Click DblClick Change See corresponding section
Form Events
Initialize Parameters
None
Description This event is called when a new instance of the Form has been created but not yet shown. The form itself is not displayed yet on the screen. Captions and values of controls can be set in the Initialize procedure if the form is modal. For non-modal forms all initialisations of the form controls must be done in the Initialize event. See method OpenForm.
Form Modules
Page 121-2
Example
Sub FormName_Initialize FormName is the name of the Form module. FirstName.Value = "Fred Flintstone" Initializes the form Textbox FirstName ' Works only if Form is modal. End Sub
Modality Parameters
Modal As Boolean
Description This event is called immediately before a new instance of the Form is created. A form window is not created yet at this moment. By default a Form is modal. A non-modal form should not call any functions of Pythagoras that change a document. The result could be unpredictable. Example
Sub FormName_Modality(Modal As Boolean) FormName is the name of the Form module. Modal = False End Sub
Terminate Parameters
None
Description This event is called when an instance of the Form is about to be deleted. This means that all references to the form have been set to Nothing. Example
Sub FormName_Terminate FormName is the name of the Form module Execute termination code if any. End Sub
QueryClose Parameters
Cancel As Boolean, Mode As Integer
Description This event is called when a request has been made to close the form. Setting Cancel = True will stop the form from being closed. When Mode = vbFormControlMenu, the user has clicked the Close box of the form. When Mode = vbFormCode, the close request has come from VBA using the Unload statement. The Unload statement is currently not supported. For non-modal forms data in the form controls should be retrieved in QueryClose. In other places it's not sure that the information is still available. Example
Sub FormName_QueryClose(Cancel As Boolean, Mode As Integer) 'Do Something End Sub
Click Parameters
None
Description This event is called when the mouse is clicked in one of the following controls: CommandButton, ToggleButton, CheckBox or OptionButton. Example
Sub ControlName_Click 'Do Something End Sub ' ControlName is the name of the control
Form Modules
Page 121-3
DropButtonClick Parameters
None
Description This event is called when the mouse is clicked in the drop button of a ComboBox or DropDownList control. The event is also called when the drop-down list disappears. Example
Sub ControlName_DropButtonClick 'Do Something 'e.g. make a new list depending on information in other controls End Sub
DblClick Parameters
None
Description This event is called when the mouse is double clicked in one of the following controls: OptionButton, ListBox, DropDownList, ComboBox. Example
Sub ControlName_DblClick End Sub ControlName is the name of the control
Change Parameters
None
Description This event is called when the value of the control has changed. This event is applicable to the following controls : ToggleButton : when the push state of the button changes CheckBox : when the checked state of the button changes OptionButton : when the checked state of the button changes TextBox : when the text in the control changes ListBox : when the selected item changes DropDownList: when the selected item changes SpinButton : when the selected item changes ComboBox : when the text in the control changes or selected item changes MultiPage : when the selected tab changes Example
Form Modules
Page 121-4
MyForm is the name of FormModule An instance of MyForm will be created. Will show the form on the screen.
The following code is executed when the form is closed. Name = Form.FirstName.Value Name = Name & " " & Form.LastName.Value Set Form = nothing Example 2 : code executed in a Form Module Sub OkButton_Click Executed when OkButton is clicked If (Len(Me.FirstName.Value) <> 0) And (Len(Me.LastName.Value) <> 0) Then OkClicked = True Hide Else MsgBox "Enter name" End If End Sub
Form Object
Caption Returns
String
Description Sets or returns the text displayed in the form title. Example
Sub FormName_Initialize FormName is the name of the Form module. Me.Caption = "Name and Address" Sets the title of the form. End Sub
Floating Value
Boolean
Description When set True, the form will come on top of other windows. By default Floating = False. Note that this property affects the form window, so it must be called after the method OpenForm is called and before the method CloseForm is called. Example
Form.Floating = True Form will be floating (= top window)
Show Description Shows the form on the screen. For modal forms, this call does not return until the form is hidden. All forms are modal. Example
Form.Show
Hide Description This call hides the form. When this call is executed, VBA program will continue with the statements following the Show method. Example
Form.Hide
Form Modules
Page 121-5
OpenForm Description For a nonmodal form, creates a form window and starts a window message loop in a separate thread The form is not shown on the screen. This call returns immediately. For a modal form, this call acts like the method Show. The Open statement must be executed before changing any other Form Object . In case of a non-modal form, initialisations of form controls must be done by Initialize event procedure. Example
Form.OpenForm
CloseForm Description For a nonmodal form, closes and destroys the form window. For a modal form, this call acts like the method Show. Example
Form.CloseForm
GetPosition Parameters
X As Long, Y As Long
Description Returns the position of a form on the screen in arguments X and Y. Example
Form1.GetPosition X, Y
SetPosition Parameters
X As Long, Y As Long
Description Sets the position of a form on the screen as specified by arguments X and Y. Example
Form1.SetPosition 0, 0 Upper-left corner of the screen
Width Returns
Long
Height Returns
Long
ScreenWidth Returns
Long Page 121-6
Form Modules
Description Returns the width of the screen in pixels the form is displayed on. Example
Dim SW As Long SW = Form1.ScreenWidth
ScreenHeight Returns
Long
Description Returns the height of the screen in pixels the form is displayed on. Example
Dim SH As Long SH = Form1.ScreenHeight
Common properties
SetFocus Returns
nothing
Description This method gives the input focus to this control. Example
FirstName.SetFocus
Visible Returns
Boolean
Description Sets the control visible or invisible. When reading returns if the control is visible. Example
OkButton.Visible = False
Enabled Returns
Boolean
Description Sets the control enabled or disabled. When reading returns if the control is enabled. Example
OkButton.Enabled = False
ControlTipText Returns
String
Form Modules
Page 121-7
TextBox Control
Value ( = Text) Returns
String
Description Sets or returns the text displayed in the TextBox control. Example
Form.FirstName.Value = "Andrey" Sets the text in the TextBox FirstName. or (when statement is in the Form Module) FirstName.Value = "Andrey" = FirstName.Text = "Andrey"
MaxLength Returns
Long
Description Sets or returns the maximum number of characters that can be intered in the TextBox control. Example
FirstName.MaxLength = 16
Locked Returns
Boolean
Description Sets the control enabled or disabled. When reading returns if the control is enabled. Example
OkButton.Locked = True
Label Control
Caption Returns
String
Description Sets or returns the text displayed in the Label control. Example
Form.LabelFirstName.Caption = "First Name"
CommandButton Control
Value Returns
Boolean
Form Modules
Page 121-8
Description Reading this property always returns False. Setting this property to TRUE triggers the "Clicked" event for the control. Example
Form.ButtonFind.Value = True ' This will trigger the Clicked event.
Caption Returns
String
Description Sets or returns the text displayed in the CommandButton control. Example
Form.ButtonFind.Caption = "Search"
ToggleButton Control
Value Returns
Boolean
Description Sets or returns the status of the ToggleButton control. True means the control is in the pressed down state. Example
If Form.ToggleButton1.Value Then End If
Caption Returns
String
Description Sets or returns the text displayed in the ToggleButton control. Example
Form.ToggleButton1.Caption = "Home address" Form.ToggleButton2.Caption = "Business address"
CheckBox Control
Value Returns
Boolean
Description Sets or returns the checkedstate of the CheckBox control. TRUE means the control is checked. Example
If Form.CheckBox1.Value Then End If
Form Modules
Page 121-9
Caption Returns
String
Description Sets or returns the text displayed in the CheckBox control. Example
Form.CheckBox1.Caption = "I wish to receive the monthly newsletter"
OptionButton Control
Value Returns
Boolean
Description Returns the status of the OptionButton control. True means the control is in the checked state. When setting the value to True, all other buttons in the group are cleared automatically. You can't set an option button unchecked because it is unknown which other button in the group must be checked. Example
If Form.OptionButton1.Value Then End If
Caption Returns
String
Description Sets or returns the text displayed in the OptionButton control. Example
Form.OptionButton1.Caption = "Home address" Form.OptionButton2.Caption = "Business address"
SpinButton Control
Value Returns
Long
Locked Returns
Boolean
Description Enables or disables user editing of the control . When reading returns if the control is user editable.
Form Modules
Page 121-10
Example
Spinbutton1.Locked = False
Frame Control
Caption Returns
String
Description Sets or returns the text displayed in the Frame control. Example
Form.Frame.Caption = "Selection"
ControlTipText Description
See common properties.
ListBox Control
ColumnTitle (synonym ListHeader) Parameters Returns
Column As Long String
Description Sets or returns the title of the column specified by the parameter Column. Column index starts from 0. Example
Names.ColumnTitle(0) = "Names"
Text Returns
String
Description Sets or returns the text of the currently selected item in the list. Example
SelectedName = Form.Names.Text
ListCount Returns
Long
ListIndex Returns
Long
Form Modules
Page 121-11
Description Reading returns the index of the currently selected item. Setting a value changes the selected item in the control. The first item in the control has an index value of zero. Example
Names.ListIndex = 0 Selects the first item of the ListBox
Description Sets or returns the text of the item specified by the parameters Row and Column. Column is ignored if not applicable for the specific instance of the control. Example
With Names Item1 = .AddItem("1") Item2 = .AddItem("2") Item3 = .AddItem("3") Item4 = .AddItem("4") .List(0, 1) = "Andrey" .List(1, 1) = "Alex" .List(2, 1) = "Michael" .List(3, 1) = "Corban" End With
ColumnWidths Returns
String
Description Sets the widths of the columns in the control. A setting of 1 or blank, results in a calculated optimal width. A value greater than 0 explicitly specifies the width of the column in points. To separate column entries in the string use a semicolon character (;) as a list separater. (Eg. "4.5;7;10.0"). Passing an empty string sets all coumns to their calculated optimal width. For the optimal width to be set you need to use this property after you have added are changed the text of the control items. Example
Names.ColumnWidths := "30;70" or Names.ColumnWidths := "30;-1"
Description This method adds an item to the control. The parameter is the string value of the item to add. For controls with multiple columns this sets the text of the first column (column 0). The returned value is the items position in the list of items in the control. Example
Item1 = Names.AddItem("1")
Form Modules
Page 121-12
Description This method removes an item from the control. The returned value indicates if the removal was successful. Example
If Names.RemoveItem(3) Then End If
Clear Returns
None
Description This method removes all items from the control. Example
Names.Clear
Description Sets or returns the selected state of the item specified by the parameter Row. This property is useful in amultiselect list box. It can be used to determine the selected rows and to select or deselect rows in a list. Index of first Row starts counting from zero. Example
If ListBox1.Selected(i) = True Then ListBox1.Selected(i) = False End If
DropDownList Control
Text Returns
String
Description Sets or returns the text of the currently selected item in the list. Example
SelectedCountry = Form.Countries.Text
ListCount Returns
Long
ListIndex Returns
Long Page 121-13
Form Modules
Description Reading returns the index of the currently selected item. Setting a value changes the selected item in the control. The first item in the control has an index value of zero. Example
Countries.ListIndex = 0 Selects the first item of the ListBox
Description Sets or returns the text of the item specified by the parameters Row and Column. Column is ignored if not applicable for the specific instance of the control. Example
Description This method adds an item to the control. The parameter is the string value of the item to add. The returned value is the items position in the list of items in the control. Example
Item = Countries.AddItem("Belgium")
Description This method removes an item from the control. The returned value indicates if the removal was successful. Example
If Countrie.RemoveItem(3) Then End If
Clear Returns
None
Description This method removes all items from the control. Example
Names.Clear
Form Modules
Page 121-14
Combobox Control
Value Returns
String
Description Sets or returns the text value of the currently selected row of the contol. Example
SelectedCountry = Form.Countries.Value
Text Returns
String
Description This property returns or sets the text of the control. In addition, when setting this property the text is matched against the items in the combo box list and if a match is found the selected item is changed to the matched item. Example
SelectedCountry = Form.Countries.Text
MaxLength Returns
Long
Description Sets or returns the maximum number of characters that can be entered into the control. A value of less than or equal to zero defines an operating system default limit. Example
Names.MaxLength = 30
Clear Returns
None
Description This method clears the text of the control and removes all items from the dropdown list of the control. Example
Names.Clear
ListCount, ListIndex, List, AddItem, RemoveItem Description See properties and methods of DropDownList SetFocus, Visible, Enabled, ControlTipText Description See common properties.
Multipage Control
Caption Returns
String
Description Sets or returns the text displayed in the selected tab of the Multipage control.
Form Modules
Page 121-15
Example
Value Returns
Integer
Description Sets or returns the index of the selected tab. The pages are indexed starting at zero. Example
ActTab = Settings.Value
Form Modules
Page 121-16
Description X,Y and Z coordinates. Mainly used for operations requiring 3D coordinates. Example
Dim XYZValue As XYZ XYZValue.X = 10 XYZValue.Y = 10 XYZValue.Z = 0
XY
Fields
X As Double, Y As Double
Description X and Y coordinates. Mainly used for operations requiring 2D coordinates. Example
Dim XYValue As XY XYValue.X = 10 XYValue.Y = 10
XYV
Fields
X As Double, Y As Double, V() As Double
KMLGeoPoint
Fields
Longitude As Double, Latitude As Double, Altitude As Double
Description Longitude and Latitude coordinates in degrees decimal. E.g. 50.70356 -180 <= Longitude <= +180. -90 <= Latitude <= +90. If used for export to KML: Lat. Long. in WGS84. Latitude is in meters. Example
Page 122-1
RGB
Fields
Red As Byte, Green As Byte, Blue As Byte
KMLColor
Fields
Red As Byte, Green As Byte, Blue As Byte, Alpha As Byte
Rectangle
Fields
P1 As XY, P2 As XY x1 As Double, y1 As Double, x2 As Double, y2 As Double
alternative
Description A rectangle is defined by 2 points, namely P1 and P2. Alternatively, the x and y values of the points can be accessed directly. Warning : in some cases P1 must be top left point and P2 must be the bottom left point. Example
Dim R As Rectangle R.P1.X R.P1.Y R.P2.X R.P2.Y = = = = 1.0 2.0 10.0 20.0
' following code gives the same result. R.x1 = 1.0 R.y1 = 2.0 R.x2 = 10.0 R.y2 = 20.0
ObliqueRectangle
Fields
BottomLeft As XY, TopLeft As XY, TopRight As XY, BottomRight As XY
Description The record type ObliqueRectangle consists of 4 points. These four points should define a rectangle which is not necessarily horizontal. Example
Dim R As ObliqueRectangle
Page 122-2
R.Bottomleft.x = 0.0 R.BottomLeft.y = 0.0 R.TopLeft.x = 0.0 R.TopLeft.y = 10.0 R.TopRight.x = 10.0 R.TopRight.y = 10.0 R.BottomRight.x = 10.0 R.BottomRight.y = 0.0
Transformation
Fields
Fi As Double, D As XYZ, ScaleFactor As Double synonyms : Fi : RotationAngle D.X, D.Y, D.Z : dX, dY, dZ
Description This record type defines the values to calculate a transformation from XY to X'Y'. Transformation is used in the Units object by all "Conversion" methods. For the exact meaning of the parameters, see the description of the Units method SetTransformation. Example
Dim Tr As Transformation Tr.Fi = 0.0 Tr.D.X = 1000.0 Tr.D.Y = 1000.0 Tr.D.Z = 10.0 Tr.ScaleFactor = 1.0 ' ' ' ' or or or or Tr.RotationAngle = 0.0 Tr.dX = 1000.0 Tr.dY = 1000.0 Tr.dZ = 10.0
TransformationParameters
Fields
RotationAngle As Double, dX As Double, dY As Double, dZ As Double, ScaleFactor As Double.
synonyms : see Tranformation. Description This record is synonymous to the type Tranformation. It is used by the object HelmertTransformation. Example
Dim Tr As TransformationParameters Tr.RotationAngle = 0.0 Tr.dX = 1000.0 Tr.dY = 1000.0 Tr.dZ = 0.0 Tr.ScaleFactor = 1.0
Style
Fields
Symbol As Boolean, Group As String, Item As String, StyleId As Integer
Description This record type is used to define point styles, line styles and hatch styles. If the field Symbol = TRUE, the fields Group and Item need to be filled in. Group and Item define the style of the document or the system symbol. If the field Symbol = FALSE, the field StyleId defines the standard styles provided by Pythagoras. Example
Dim NewStyle As Style Dim SelectedObjects As Selection ' Set the style of all selected points to Example, Doorstep. With NewStyle .Symbol = True
Page 122-3
.Group = "Example" .Item = "Doorstep" End With SelectedObjects.PointStyle = NewStyle ' Set the style of all selected lines to Example, Wall. With NewStyle .Symbol = True .Group = "Example" .Item = "Wall" End With SelectedObjects.LineStyle = NewStyle ' Set the style of all selected lines to DashDot. With NewStyle .Symbol = False .StyleId = ptDashDot End With SelectedObjects.LineStyle = NewStyle
SelectionCriteria
Fields
SelectionType As Integer, Objects As Long, Wallpaper As Boolean, OnSubDocument As Boolean, SubDoc As SubDocument OnLayer As Boolean, Layer As String, OnColor As Boolean, Color As Integer, OnTrueColor As Boolean, TrueColor As RGB, OnPointStyle As Boolean, PStyle As Style, OnLineStyle As Boolean, LStyle As Style, OnLineWidth As Boolean, LWidth As Integer, OnPattern As Boolean, Pattern As Style, OnPointNumber As Boolean, FromPntNr As String, ToPntNr As String, OnElevation As Boolean, z_Selection As Integer, z As Double, OnComment As Boolean, CommentSelection As Integer, CompareStr As String
Description This record type is currently only used as a parameter in the FlaggedObjects method MakeSet. The purpose is to provide criteria for building up FlaggedObjects. SelectionType : must be either ptNewSelection, ptAddToSelectedObjects, ptOnSelectedObjects or ptRemoveFromSelection. Field Wallpaper defines whether objects of wallpaper layers and wallpaper subdocuments are included. If this parameter is True then objects of all layers of all visible subdocuments are looked through. Otherwise objects of wallpaper layers and of wallpaper subdocuments are included. z_Selection : must be either ptEqual, ptAboutEqual, ptLessOrEqual or ptGreaterOrEqual. If CommentSelection = ptAboutEqual, then the number of decimal places used for comparison is defined by the actual settings in the user preferences. Possible values of CommentSelection : see section Constants, Compare. SelectionCriteria can be initialised with the Application method InitSelectionCriteria. Example
See the FlaggedObjects method MakeSet.
RowSetDefinition
Fields
RowSetType As PtRowSetType, Name As Variant (String or DBQuery), ObjectTypes As Long, Overlay As PtRowSetBaseOverlay,
Page 122-4
SheetName As String
Description A reference to a rowset. Name is a name of a DB table or a DB view or a temporary query; it is ignored for object sets. ObjectTypes is set of CAD object types to be included to a rowset, it is ignored for tables and queries. It must be defined in the same way as a value of class DBTable property ObjectTypes. Overlay is meaningful only when RowSetType=ptObjectSet, it defines objects of what overlay are included to the rowset. SheetName is meaningful only when RowSetType=ptObjectSet and Overlay<>ptDrawingOverlay, it defines objects of what sheet are included to the rowset. SheetName="" means that objects of the active sheet are included. This data type is used to define base rowsets for queries. Note that it is senseless to specify Name as a name of system table. Use instead RowSetType=ptObjectSet with appropriate value of ObjectTypes. Example
Dim RowSet As RowSetDefinition RowSet.RowSetType = ptObjectSet RowSet.ObjectTypes = ptLine + ptArc + ptClothoid + ptCircle
SelectCondition
Fields
Column As Variant Compare As PtCompare Value As Variant
Description This record type is used as a parameter in the FlaggedObjects method MakeSetDB. The purpose is to provide criteria for building up FlaggedObjects. This record is also returned by the Application method SelectCondition. Column : Variant (Subtype of Column is either Integer or String). When this value is NULL SelectCondition value is ignored. This feature may be useful to skip elements in an array of SelectCondition values. Compare: must be either ptCompareEqual, ptCompareLessOrEqual, ptCompareGreaterOrEqual, ptCompareStartsWith, ptCompareContains, ptCompareEndsWith, ptCompareIsNull or ptCompareIsNotNull. Value: Variant. Subtype depends on the type of data in the column. Example See the FlaggedObjects method MakeSetDB and the Application method SelectCondition.
MatchCondition
Fields
Kind As PtMatchConditionKind, Expression As String, Distance As Double
Description A match condition in an aggregation query. When Kind = ptConditionExpression then Expression is a match condition. When Kind = ptConditionDistance then a match condition is the following: distance between the main and the auxiliary objects is not more than Distance expressed in length units used for this query. Note that so far as distance is always non-negative, definition Distance=0. actually defines a condition that distance between objects is 0 (i.e. they either touch or overlap). When Kind = ptConditionEncloses then a match condition is the following: the auxiliary object lies inside the main object.
Page 122-5
When Kind = ptConditionInside then a match condition is the following: the main object lies inside the auxiliary object. Example
Dim Match As PtMatchCondition ' "Capital" column value in the main base equals to ' "Name" column value in the auxiliary base Match.Kind = ptConditionExpression Match.Expression = "Main.Capital=Aux.Name"
WhereCondition
Fields
Compare As PtCompare, Feature As PtObjectFunction, Column As String, Value As Variant, ValueType As Byte, Aggregation As PtAggregateFunction
Description A where condition in a query. An object property or a column value is compared with some value. Permitted values for Compare are ptCompareEqual, ptCompareGreater, ptCompareLess, ptCompareGreaterEqual, ptCompareLessEqual, ptCompareNotEqual, ptCompareStartsWith, ptCompareContains, ptCompareEndsWith, ptCompareIsNull, ptCompareIsNotNull, ptCompareIsTrue and ptCompareIsFalse. When Feature = ptFunctionEmpty then a value of column with name Column is compared with Value, otherwise the corresponding property of the CAD object is compared with Value. When Aggregation = ptFunctionNil then a not aggregated value of the main dimension is compared. Other values may be specified only for aggregation queries and mean that an aggregated value of the auxiliary dimension is compared. Value is ignored when Compare is ptCompareIsNull, ptCompareIsNotNull, ptCompareIsTrue or ptCompareIsFalse. ValueType defines a type of Value and in most cases is equal to actual type of Value. Only when the where condition is applied to a column of type substandard for VBA ( ptDateOnly , ptTime or ptCadObjectType ) and Aggregation<>ptFunctionCount, ValueType is equal to one of these values. In the last case Value should have type vbDate, vbDate or one of integer types correspondingly. Example
Dim Where As WhereCondition ' Sum of all Weight column values is less than 5 Where.Feature = ptFunctionEmpty Where.Column = "Weight" Where.Compare = ptCompareLess Where.Value = 5 Where.ValueType = vbLong Where.Aggregation = ptFunctionSum
ColumnDefinition
Fields
Name As String, Description As String, IsComputed As Boolean, RowSet As String, Expression As String, Aggregation As PtAggregateFunction, Format As String, Fractional As Byte
Description A definition of a query column. Name and Description are correspondingly a name and textual description of the column. Fields IsComputed, RowSet, Expression and Aggregation have the following meanings in the following cases:
Page 122-6
When IsComputed = True for extension or aggregation queries: this column is a computed one; Expression is a textual expression to compute; the other fields are ignored. When IsComputed = False for extension queries: this column is a reference to a base rowset column; RowSet contains an alias name of a base rowset, if it is empty then the main base rowset is referenced; Expression is a name of the referenced column; Aggregation is ignored. When IsComputed = False and Aggregation = ptFunctionNil for aggregation queries: this column is a reference to a main base rowset column; Expression is a name of the referenced column; RowSet is ignored. When IsComputed = False and Aggregation = ptFunctionCount for aggregation queries: this column is a count reference to the auxiliary base rowset; the other fields are ignored. When IsComputed = False and Aggregation is one of ptFunctionMin, ptFunctionMax, ptFunctionSum and ptFunctionAvg for aggregation queries: this column is an aggregated reference to an auxiliary base rowset column; Expression is a name of the column to be aggregated; Property and RowSet are ignored. Format and Fractional define how column data are to be converted to textual form when displaying. Format is meaningful only for date/time type columns, it must contain a string complying with simplified ICU date/time format (see Pythagoras Reference Guide, the Defaults Menu, Preferences, Date and Time) Fractional is meaningful only real type column, it defines how many fractional decimal digits is to be displayed. Example
Dim ColDef As ColumnDefinition Dim Query As DBQuery Dim ColNo As Integer ' Define a column for an extension view being a mirror ' of column "Name" of dimension "Person" ColDef.Name = "OwnerName" ColDef.Description = "Full name of an owner of the parcel" ColDef.IsComputed = False ColDef.RowSet = "Person" ColDef.Expression = "Name" ColNo = Query.AddColumn(ColDef)
DocInfo
Fields
Info1 As String, Info2 As String, Info3 As String, Info4 As String, Info5 As String, Info6 As String, Info7 As String, Info8 As String, Info9 As String,
Set A = New Application A.GetActiveDocument D If Not (D Is Nothing) then Txt.Info1 = " dit " Txt.Info2 = " is " Txt.Info3 = " een test natuurlijk " D.Info = Txt Tst = D.Info MsgBox Tst.Info1 & vbNewLine & Tst.Info2 & vbNewLine & Tst.Info3 End If Set A = Nothing Set D = Nothing
Page 122-7
WindowCoord
Fields
X As Long, Y As Long
set A = New Application A.GetActiveDocument D If NOT D is nothing Then D.GetWindow W p = W.Position MsgBox "Position : " & str(P.x) & " , " & str(P.y) P.x = P.x + 24 P.y = P.y - 30 W.Position = P W.SetWindowSize W.Width\2, W.Height\2 end if
Line2D
Fields
P1 As XY, P2 As XY
Line3D
Fields
P1 As XYZ, P2 As XYZ
LinePair
Fields
L1 As CadObject, L2 As CadObject
Description This record type contains may contain 2 Cadobjects. The CadObjects must be either of type Line or Arc. Any combination is allowed. Example
Dim Lines As LinePair Dim L As Line, A As Arc
Page 122-8
Dim Obj As CadObject L.GetCadObject Set Lines.L1 = A.GetCadObject Set Lines.L2 = Obj Obj Obj Obj
ColumnValue
Fields
Column As Variant, Value As Variant
Description This record type is used to read and write data from/to a row of a table. Column is either the name or the number of the column. Numbering of columns starts from 0. Column may be = Null. When = Null, this means that this ColumnValue may not be taken into account when the data is assigned to a row. Value : the value of the Column. When used to read/write rows of a table, the subtype of Value should correspond with the type of the column in the table or be Null. See also object DBRow. Example
Dim C As ColumnValue C.Column = 5 C.Value = 123.55
ValueIndex
Fields
Value As Variant, Index As Long
Description This record type is used to help to sort records of any type. For more information see the Application method SortValueIndex. Example
Dim D As ValueIndex C.Value = "My name" C.Index = 55
UUID
Fields No accessible fields. Description This record describes Universally Unique Identifier (see OpenGroup standard http://www.opengroup.org/onlinepubs/9629399/apdxa.htm), also known as GUID (Globally Unique Identifier).
ProfileElement
Fields
IP As XY, BC As XY, EC As XY, VCControl As Integer, VCType As Integer Center As XY FixedRL As Double ' ' ' ' ' ' ' ' Intersection Point Begin of Curve End of Curve ptVCAutomatic, ptVCFixedRadius or ptVCFixedLength ptVCCircle or ptVCParabola Center of circular vertical curve. Not given in case of Parabola The predefined Radius (ptVCFixedRadius)
Page 122-9
Description The record type ProfileElement contains all information related to a vertical curve in a profile. The first and the last point of the profile are also vertical curves with Radius = 0 and Length = 0. Example
See Road method GetProfileData
HorizontalTransition
Fields
IP As XY, ' Intersection Point Automatic As Boolean Type As Integer ' See constants: Road Horizontal Aligment Transition Type NrOfElements As Long Elements(1 To 3) As PathElement ' =3 if Spiral-Arc-Spiral
Description The record type HorizontalTransition contains all information related to the horizontal transition. Example
See Road method GetHorIPData
SuperElevationPoint
Fields
Type As Integer Pnt As XY ' ptNCIn, ptHCIn,ptFSEIn ptFSEOut, ptHCOut, ptNCOut ' Coordinates of the point
Description The record type SuperElevationPoint contains information (type and coordinates) related to a point in the superelevation transition. Example See data type SuperElevation
SuperElevationData
Fields
SuperElevated As Boolean AutomaticMaximum As Boolean FullSuperElevation As Double AutomaticPositions As Boolean NrOfPoints As Long Points(1 To 6) As SuperElevationPoint ' ' ' ' ' True if superelevated If True, FullSuperElevation is calculated by Pythagoras. The amount of Superelevation The positions are automatically defined.
Description The record type SuperElevationData contains all information related to the superelevation of one horizontal transition. Example
See Road method GetSuperElevationData
SystemParameters
Fields
DWGExportAttribs As Boolean, DWGExportZAsAttrib As Boolean, DWGExportZAttribLabel As String, DWGImportUCS As Boolean, DWGExport2D As BOOLEAN ' ' ' ' ' Default Default Default Default Default = = = = = True False "Z" True False
Description This record type defines all system parameters that can be modified with Pythagoras VBA. Pythagoras Data Types
Page 122-10
DWGExportAttribs : used when writing DWG/DXF files. If = True, BLOCKS (Pythagoras symbols) will have the DWG/DXF attributes "PointNumber" and "Comment". If = False, the attributes are not exported. DWGExportZAsAttrib : used when writing DWG/DXF files. If = True, the elevation of the point will be exported as an attribute. DWGExportZAttribLabel: used when writing DWG/DXF files. The label of the attribute for the elevation of the point. Only used if DWGExportZAsAttrib = True. DWGImportUCS : used during import of DWG/DXF files. If = True, data in the DWG/DXF file will be converted to the actual User Coordinate system set in the DWG file. DWGExport2D : used when writing DWG/DXF files. If = True, all elevations in the DWG/DXF file will become equal to 0.0. The number of fields in this type will grow in future versions of Pythagoras. Example
See application property SystemParameters.
Font
Fields
Name As String, CodePage As Integer
Description This record type defines the name and the code page (also called character set) of a font. The code pages are defined in chapter Constants section Codepage. Example
See Fonts property GetFirst, GetNext.
Location
Fields
Entity As String, Line As Long, Column As Long
Description A value of this type describes location inside a text entity. The type is useful to describe position of an error during syntactic analysis. Now it is used only in Application.GetXMLErrorPosition method. Entity can contain a name of a textual entity, for example, a path to a file. If the entity is a file then Line is a number of a line in the file and Column is a number of a character in the line. Otherwise Line = 0 and Column is a number of a character in the whole entity. Numeration of lines and columns starts form 1. Example See example XMLDocument
DTMReduce
Fields
Reduce As Boolean, T1 As Double, T2 As Double, XMin As Double, K As Double
Description Parameters for reduction calculation. If Reduce is False then no reduction will be applied and other record fields are not considered. T1 is the tolerance parameter for short distances. T2 is the tolerance parameter for long distances. XMin is a distance to switch tolerance parameter. K is a curvature of the function.
Page 122-11
Modality constants
vbApplicationModal vbSystemModal
Types constants
vbEmpty vbNull vbInteger vbLong vbSingle vbDouble vbDate vbString vbObject vbError vbBoolean vbByte vbUserDefinedType vbArray
Compare constants
vbBinaryCompare vbTextCompare vbDatabaseCompare
String constants
vbBack vbCr
Constants
Page 123-1
Language
ptAppEnglish ptAppGerman ptAppFrench ptAppDutch ptAppGreek ptAppPolish ptAppItalian ptAppRussian ptAppSerbian ptAppThai ptAppSpanish ptAppRomanian
Constants
Page 123-2
ptAppBulgarian ptAppFinnish ptAppIndonesian ptAppArabic ptAppPersian ptAppHungarian ptAppCroatian ptAppKorean ptAppSlovak ptAppLithuanian ptAppVietnamese ptAppPortuguese See Application method Language.
State of Subdocument
ptInvisibleSubDocument ptWallPaperSubDocument ptProtectedSubDocument ptEditableSubDocument
SaveBeforeClose
ptDontSave ptAskUser ptSaveAs
Overlay type
ptPaper ptDrawing
Colors
ptBlack ptRed ptGreen ptYellow ptBlue ptMagenta ptWhite ptGray ptCyan
Length Units
ptMM ptCM ptDM ptM ptDAM ptHM ptKM ptInch ptMiles ptFeet ptUSfeet
Angle Units
ptGRAD ptDEGdec ptDEGMinSec ptMIL ptSURVEY ptRADIAN : : : : : : GRAD or GON : 400 GRAD = 360 degrees Degrees decimal : 0.50 = 030'0" Degrees Minutes Seconds : 0.453020 or 030'20" 6400 MIL = 360 DMS and bearing notation : N45E radians 2pi = 360
Vertical Angle
ptVALevel ptVA90 : vertical angle is Level based. Horizontal = 0 : vertical angle is relative to zenith. Horizontal = 90
Constants
Page 123-3
ptVA270
XYZ Representation
ptRectangular ptPolar ptHVD ptHVS : coordinates : NEZ, XYZ, ... depending on Representation of rectangular coordinates : HDZ : Hor. Angle, Hor. Distance, Elevation : HDZ : Hor. Angle, Vert. Angle, Hor. Distance : HDZ : Hor. Angle, Vert. Angle, Slope Distance
Angle type
ptHorAngle ptVertAngle ptArcAngle ptBearingAngle
Scale Format
ptScaleImperial ptScaleMetric
Chainage Format
ptChainageFormatNormal ptChainageFormatPlus
Point Style
ptHiddenPoint ptCross ptXCross ptHalfXCross ptRoundDot ptRoundDotHollow ptRectDot ptRectDotHollow ptTriangle ptSplitPoint ptReferencePoint ptHotspot
Line Style
ptSolid ptDash ptDot ptDashDot ptDashDotDot
Document Version
ptV10 ptV11 ptV12 ptDXF13 ptDXF14 ptDXF2000
Constants
Page 123-4
ptDXF2004 ptDXF2007 ptDXF2010 ptDWG13 ptDWG14 ptDWG2000 ptDWG2004 ptDWG2007 ptDWG2010 ptGRBFile2D ptGRBFile2_5D ptGRBFile3D ptLastVersion
Selection
ptNewSelection ptAddToSelectedObjects ptOnSelectedObjects ptRemoveFromSelection
Compare / Condition
ptEqual ptAboutEqual ptLessOrEqual ptGreaterOrEqual ptStartsWith ptContains ptEndsWith ptNull ptNotNull
Type of intersection
ptPartiallyOverlapping ptIdenticalLines ptIntersectingLines ptCommonEndPoint
ObjectTypes
ptNoObjects ptPoint ptLine ptArc ptClothoid ptText ptRichText ptImage ptCurve ptPath ptPolygon ptCircle ptCoordinateSystem ptRoad ptCompound ptAll ptAllDBLinkable
Annotation
ptAn_Coordinate ptAn_Elevation ptAn_PointId ptAn_Area ptAn_LineLength ptAn_Comment ptAn_Bearing ptAn_XYOffset
Constants
Page 123-5
Codepage
ptWestern ptSymbol ptEastEuropean ptGreek ptCyrillic ptArabic ptThai ptHebrew ptTurkish ptVietnamese ptJohab ptBaltic Don't confuse Codepage with language of Pythagoras.
Text Style
ptUpright ptItalic
Text Weight
ptLight ptMedium ptBold ptExtraBold
Text: underline
ptUnderlineNone ptUnderlineSingle ptUnderlineDouble ptUnderlineDashed
Text: border
ptBorderNone ptBorderSingle ptBorderDouble
Text: orientation
ptTextHorizontal ptTextOrientationReadable ptTextOrientationAbsolute
Constants
Page 123-6
Images: ColorDepth
ptMonochrome ptPallet256 ptTrueColor
Polygon: styleId
ptNoFill ptHorizontalFill ptVerticalFill ptBDiagonalFill ptFDiagonalFill ptCrossFill ptBoundary1 ptBoundary2 ptBoundary1Open ptBoundary2Open ptSolidFill ptGray75 ptGray50 ptGray25 ptGray12
Polygon: border
ptNoBorder ptBorder1mm ptBorder2mm ptBorder3mm ptBorder4mm ptBorder5mm ptBorder6mm ptBorder7mm ptBorder8mm ptBorder9mm ptBorder10mm ptBorder1mmOpen ptBorder2mmOpen ptBorder3mmOpen ptBorder4mmOpen ptBorder5mmOpen ptBorder6mmOpen ptBorder7mmOpen ptBorder8mmOpen ptBorder9mmOpen ptBorder10mmOpen
PTPosition
ptBeginning ptEnd ptBefore ptAfter
Constants
Page 123-7
Paste operations
ptPasteNormal ptMirrorX ptMirrorY ptZToY ptClearPointNumbers ptAdjustSketch
Symbol Type
ptPointSymbol ptLineSymbol ptPattern ptSectionSymbol
Symbol Class
ptLibrarySymbol ptDocumentSymbol
Constants
Page 123-8
Database: PtCompare
ptCompareNil ptCompareEqual ptCompareGreater ptCompareLess ptCompareGreaterEqual ptCompareLessEqual ptCompareNotEqual ptCompareStartsWith ptCompareContains ptCompareEndsWith ptCompareIsNull ptCompareIsNotNull ptCompareIsTrue ptCompareIsFalse ptCompareAboutEqual
Database: ptRowSetType
ptTable ptQuery ptObjectSet A rowset is a A rowset is a (including DB A rowset is a DB table DB query view and system table) set of CAD objects of certain types
Database: PtQueryType
ptQueryExtension ptQueryAggregation A DB query is a simple or extension query A DB query is an aggregation query
Database: PtMatchConditionKind
ptConditionExpression ptConditionDistance ptConditionEncloses ptConditionInside Textual expression used to express condition Condition is Distance < constant Auxiliary object is inside main object Main object is inside auxiliary object
Database: PtObjectFunction
ptFunctionEmpty No object function is defined ptFunctionType ptFunctionSubdocument ptFunctionTable ptFunctionLayer ptFunctionDisplayLevel ptFunctionComment ptFunctionPointNumber ptFunctionZ ptFunctionLength ptFunctionDeltaZ ptFunctionSlopeLength ptFunctionMinZ ptFunctionMaxZ ptFunctionRadius ptFunctionAperture ptFunctionArea ptFunctionPerimeter ptFunctionN ptFunctionE ptFunctionSlopePerimeter ptFunctionKFactor ptFunctionStartingRadius
Constants
Page 123-9
Database: PtAggregateFunction
ptFunctionNil ptFunctionCount ptFunctionMin ptFunctionMax ptFunctionSum ptFunctionAvg No aggregation is assumed
Database: PtSyntaxError
ptSyntaxSuccess ptSyntaxOverflow ptSyntaxUnlimString ptSyntaxUnlimColumn ptSyntaxBadLexeme ptSyntaxUnknownFunction ptSyntaxNotAttribute Too big integer value String constant has no right delimiter Column name enclosed in apostrophes has no right delimiter Unrecognized lexeme
Unrecognized function name CAD specific function is applied to a non-attribute table or query ptSyntaxNoColumn Column with such name not found ptSyntaxNoFunction Function with such name not found ptSyntaxRightExpected Right parenthesis is expected ptSyntaxCommaExpected Comma is expected ptSyntaxCommaOrRight Comma or right parenthesis is expected ptSyntaxWrongArgType Wrong argument type ptSyntaxDifferentTypes Types of arguments are different ptSyntaxExprExpected Expression expected ptSyntaxNonArithmeticalType Arithmetical operator is applied to an expression of improper type ptSyntaxMultiplyTimes Time cannot be multiplied by time ptSyntaxDivideByTime Numeric cannot be divided by time ptSyntaxWrongSignType Wrong type for unary + or ptSyntaxWrongConcatType & is applied to not a string ptSyntaxWrongAddTypes Wrong type combination for addition ptSyntaxWrongSubtractTypes Wrong type combination for subtraction ptSyntaxNotOrdered Wrong type to compare on less or greater ptSyntaxExtra Something extra is present at the end of text ptSyntaxResultType Wrong type of the whole expression ptSyntaxAmbiguousColumn Column name is not prefixed and column with this name are present more than one dimension ptSyntax2Prefixes Two consecutive prefixes, for example, main.aux. ptSyntaxWrongPrefix Prefix is neither MAIN nor AUX for aggregation query ptSyntaxExtraPrefix Prefix is used is wrong location ptSyntaxV11 A token is met that cannot be stored to Pythagoras v11 document ptSyntaxAggrFunc Aggregate function is not permitted here ptSyntaxAuxAggrFunc Aggregate function applied to an auxiliary base rowset is not permitted here ptSyntaxMainAggrFunc Aggregate function applied to the main base rowset is not permitted here ptSyntaxWrongAlias Prefix defines dimension prohibited here ptSyntaxNoAlias Prefix is not a dimension name for extension query
Database: PtQueryValidity
ptQueryValid A query is a valid Page 123-10
Constants
ptQueryCircularQueries Circular reference of queries ptQueryBadAliasName ptQueryAliasNameRepeated ptQueryBadViewName ptQueryNoReferencedView Reference to a view that does not exist ptQueryNoReferencedTable Reference to a table that does not exist ptQueryBadLeftMatch Error in the left match expression ptQueryNoRightMatch Match column not found ptQueryNotUniqueMatch Match column is not unique ptQueryNoReferencedAlias A where condition references not existing base ptQueryNoReferencedColumn A where condition references not existing column ptQueryBadCondition A where condition contains inconsistency ptQueryBadWhereExpression An error in where expression ptQueryBadColumnExpression An error in column expression ptQueryNoMirroredColumn A direct column reference references not existing column ptQueryBadAggregationMatch Incorrect match expression for an aggregation query ptQueryBadSpatialAggregation An attempt to build a spatial aggregation when one of base rowsets is not an attribute one ptQueryBadAggregateType An attempt to apply an aggregate function to not proper data type column ptQueryBadColumnName Some column has invalid name ptQueryColumnNameRepeated Column name is repeated ptQueryNoReferencedSheet Reference to a sheet that does not exist ptQueryReferencesInvalidQuery Reference to an invalid query ptQueryNoReferencedQuery Reference to a temporary query that has been deleted ptQueryViewReferencesTempQuery View base is a temporary query
Table Import: PtImportCompletion A value of this type describes whether table import has been completed and a reason why it has not been completed.
ptImportSuccess ptImportSuccessNull Imported, but some bad data were replaced by NULL values ptImportNoFile A file to import is not found or is lockeds ptImportWrongDBFHeader An error in DBF file header (probably it is not a DBF file) ptImportWrongDBFSize Size of DBF file contradicts data in the header ptImportEmptyFieldName Empty field name in DBF file header ptImportWrongVersion Wrong or unsupported DBF file type ptImportNoFields Empty field list in DBF file header ptImportInvalidFieldDesc Error in DBF field description ptImportWrongFieldType Wrong or unsupported column type ptImportBadTableName ptImportBadColumnNames ptImportTableExists A table with such name already exists in the database and cannot be dropped
Constants
Page 123-11
Vertical Curve
ptVCCircle ptVCParabola
Path Sequence
ptP1P2 ptP2P1
Constants
Page 123-12
User Menu
ptNilUserMenuIndex
Cursors
ptCursorArrow ptCursorPoint ptCursorLine ptCursorParallel ptCursorPerpendicular ptCursorText ptCursorPolygon ptCursorCoordSystem ptCursorMeasure ptCursorWait ptCursorMagnifyingGlass ptCursorParallelSegment ptCursorCenter ptCursorMove1 ptCursorMove2 ptCursorRotate ptCursorJoin ptCursorToObject ptCursorCamera ptCursorTarget ptCursorPath ptCursorIP ptCursorArrowDown ptCursorMarker ptCursorGrabber ptCursorIntersect1 ptCursorIntersect2 ptCursorP1 ptCursorP2 ptCursorCut ptCursorCutTo1 ptCursorCutTo2 ptCursorDivide ptCursorDivideTo ptCursorNone ptCursorExtend1 ptCursorExtend2 ptCursorErasor ptCursorLasso ptCursorTextMargin ptCursorAlign ptCursorGrabHorizontal ptCursorGrabVertical ptCursorGrabCorner1 ptCursorGrabCorner2 ptCursorDrag
Constants
Page 123-13
Elevation/Value unknown
ptNilElevation ptNilValue
Program options
ptPO_RW ptPO_DTM ptPO_RD ptPO_DC ptPO_XL ptPO_DB ptPO_I ptPO_SICAD
Type of Interpolations
ptNoInterpolation ptInTrianglePlane ptNNDistance ptNNArea ptAllDistances
Synchronize Dictionary Data Options Description Values of this enumeration are used in methods Application.OpenDocument and Subdocuments.AddSubDocument. They define what to do when the main document and the subdocument to open/add contain a database dictionary table with the same name and structure, but with different datastamps.
Constants
Page 123-14
See also Pythagoras Manual, Chapter Database, section Tables, subsection Tables and subdocuments for description of conception of datastamp.
ptDataOfOverview : Ignore subdocument data, leave data as it is in the main overview document ptDataOfSubdocument : Delete data and replace them by data from subdocument ptDataMostRecent : Prefer newer data (when the last change was made later) ptDataRaiseError : Raise an error ptDataDontOpenSubdocument: Dont open subdocument in case of conflict
Charsets
This enumeration is described completely according to an IANA standard (see http://www.iana.org/assignments/ianacharset-mib).
other unknown csASCII csISOLatin1 csISOLatin2 csISOLatin3 csISOLatin4 csISOLatinCyrillic csISOLatinArabic csISOLatinGreek csISOLatinHebrew csISOLatin5 csISOLatin6 csISOTextComm csHalfWidthKatakana csJISEncoding csShiftJIS csEUCPkdFmtJapanese csEUCFixWidJapanese csISO4UnitedKingdom csISO11SwedishForNames csISO15Italian csISO17Spanish csISO21German csISO60DanishNorwegian csISO69French csISO10646UTF1 csISO646basic1983 csINVARIANT csISO2IntlRefVersion csNATSSEFI csNATSSEFIADD csNATSDANO csNATSDANOADD csISO10Swedish csKSC56011987 csISO2022KR csEUCKR csISO2022JP csISO2022JP2 csISO13JISC6220jp csISO14JISC6220ro csISO16Portuguese csISO18Greek7Old csISO19LatinGreek csISO25French csISO27LatinGreek1 csISO5427Cyrillic csISO42JISC62261978
Constants
Page 123-15
csISO47BSViewdata csISO49INIS csISO50INIS8 csISO51INISCyrillic csISO54271981 csISO5428Greek csISO57GB1988 csISO58GB231280 csISO61Norwegian2 csISO70VideotexSupp1 csISO84Portuguese2 csISO85Spanish2 csISO86Hungarian csISO87JISX0208 csISO88Greek7 csISO89ASMO449 csISO90 csISO91JISC62291984a csISO92JISC62991984b csISO93JIS62291984badd csISO94JIS62291984hand csISO95JIS62291984handadd csISO96JISC62291984kana csISO2033 csISO99NAPLPS csISO102T617bit csISO103T618bit csISO111ECMACyrillic csa71 csa72 csISO123CSAZ24341985gr csISO88596E csISO88596I csISO128T101G2 csISO88598E csISO88598I csISO139CSN369103 csISO141JUSIB1002 csISO143IECP271 csISO146Serbian csISO147Macedonian csISO150 csISO151Cuba csISO6937Add csISO153GOST1976874 csISO8859Supp csISO10367Box csISO158Lap csISO159JISX02121990 csISO646Danish csUSDK csDKUS csKSC5636 csUnicode11UTF7 csISO2022CN csISO2022CNEXT csUTF8 csISO885913 csISO885914 csISO885915 csISO885916 csGBK csGB18030 csOSDEBCDICDF0415 csOSDEBCDICDF03IRV csOSDEBCDICDF041 csISO115481
Constants
Page 123-16
csKZ1048 csUnicode csUCS4 csUnicodeASCII csUnicodeLatin1 csUnicodeIBM1261 csUnicodeIBM1268 csUnicodeIBM1276 csUnicodeIBM1264 csUnicodeIBM1265 csUnicode11 csSCSU csUTF7 csUTF16BE csUTF16LE csUTF16 csCESU8 csUTF32 csUTF32BE csUTF32LE csBOCU1 csWindows30Latin1 csWindows31Latin1 csWindows31Latin2 csWindows31Latin5 csHPRoman8 csAdobeStandardEncoding csVenturaUS csVenturaInternational csDECMCS csPC850Multilingual csPCp852 csPC8CodePage437 csPC8DanishNorwegian csPC862LatinHebrew csPC8Turkish csIBMSymbols csIBMThai csHPLegal csHPPiFont csHPMath8 csHPPSMath csHPDesktop csVenturaMath csMicrosoftPublishing csWindows31J csGB2312 csBig5 csMacintosh csIBM037 csIBM038 csIBM273 csIBM274 csIBM275 csIBM277 csIBM278 csIBM280 csIBM281 csIBM284 csIBM285 csIBM290 csIBM297 csIBM420 csIBM423 csIBM424 csIBM500 csIBM851
Constants
Page 123-17
csIBM855 csIBM857 csIBM860 csIBM861 csIBM863 csIBM864 csIBM865 csIBM868 csIBM869 csIBM870 csIBM871 csIBM880 csIBM891 csIBM903 csIBBM904 csIBM905 csIBM918 csIBM1026 csIBMEBCDICATDE csEBCDICATDEA csEBCDICCAFR csEBCDICDKNO csEBCDICDKNOA csEBCDICFISE csEBCDICFISEA csEBCDICFR csEBCDICIT csEBCDICPT csEBCDICES csEBCDICESA csEBCDICESS csEBCDICUK csEBCDICUS csUnknown8BiT csMnemonic csMnem csVISCII csVIQR csKOI8R csHZGB2312 csIBM866 csPC775Baltic csKOI8U csIBM00858 csIBM00924 csIBM01140 csIBM01141 csIBM01142 csIBM01143 csIBM01144 csIBM01145 csIBM01146 csIBM01147 csIBM01148 csIBM01149 csBig5HKSCS csIBM1047 csPTCP154 csAmiga1251 csKOI7switched csBRF csTSCII csCP51932 cswindows874 cswindows1250 cswindows1251 cswindows1252
Constants
Page 123-18
XMLDocumentVersion
xmlV1_0 xmlV1_1
XMLItemType
xmltText xmltPI xmltComment xmltElement
XMLWhiteSpaceFacet
xmlPreserve xmlReplace xmlCollapse
XMLCompletionCode
xmlcSuccess xmlcOpenError xmlcReadError xmlcTooLongFileName xmlcNoFileInWeb 0 1 Error opening text file 2 Error reading text file 3 File name length > 512 4 Error trying to download a file from the Web xmlcEncodingNotSupported 5 Specified encoding is not supported on current OS xmlcCreateError 6 Error creating text file xmlcExternalEntity 7 Document contains external entity reference reading local file xmlcExternalDTD 8 Document contains external DTD reference reading local file xmlcIllegalChar 10 Illegal character in text file xmlcIllegalPubidChar 11 Public identifier contains prohibited character xmlcIllegalCharData 12 "]]>" inside character data xmlcIllegalAttrValue 13 ">" or "&" not beginning character or entity reference met xmlcIllegalEntityValue 14 "%" not beginning parameter reference or "&" not beginning character reference met xmlcUnlimitedString 15 Unpaired quotes found xmlcUnlimitedCDATA 16 EOF during scanning CDATA block xmlcInvalidComment 17 Comment contains -xmlcUnlimitedComment 18 EOF during scanning comment xmlcIllegalCharRef 19 xmlcSemicolonExpected 20 Semicolon missing after character or entity reference xmlcIllegalRefChar 21 Character reference defines illegal character xmlcIllegalPI 22 <? is not followed by name xmlcIllegalPIName 23 <? is followed by XML inside file xmlcUnlimitedPI 24 EOF during scanning PI xmlcEntityNotDefined 25 No entity has name defined in the entity reference xmlcSpaceExpected 26 White spaces missing xmlcEqualsExpected 27 Equals sign missing xmlcStringExpected 28 Quoted string missing
Constants
Page 123-19
xmlcAttrRefExtEntity
29 Attribute Value contains reference to external entity xmlcIntEntityRefParameter Entity Value in DTD contains reference to parameter entity xmlcAttributeRepeated 30 Attribute name is repeated xmlcEndTagExpected 31 End tag must begin here xmlcTagNamesDiffer 32 Names in start and end tags are different xmlcIllegalVersion 33 XML version is neither 1.0 nor 1.1 xmlcNoVersion 34 XML header in main file does not contain version designation xmlcIllegalEncoding 35 Encoding name is not recognized xmlcNoEncoding 36 XML header in not main file does not contain encoding designation xmlcIllegalStandalone 37 Standalone parameter value is neither "yes" nor "no" xmlcGreaterExpected 38 > missing xmlcIllegalEntityContent 39 Referenced entity content is out of syntax xmlcCircularReference 40 Entity circular reference xmlcUnparsedEntity 41 Unparsed entity referenced as &name xmlcUnlimitedStartTag 42 EOF during scanning start element tag xmlcNameExpected 43 xmlcNmTokenExpected 44 Name token missing xmlcLeftExpected 45 ( missing xmlcRightExpected 46 ) missing xmlcExternalIDExpected 47 External ID missing xmlcAttrTypeExpected 48 Attribute type definition should start here xmlcConditionalInternal 49 Conditional section should not be in the internal DTD xmlcRightBracketExpected 50 ] missing xmlcNoMainElement 51 Main document element missing xmlcExtraContent 52 Extra content at the end of file xmlcInvalidDocument 53 Invalid Document xmlcFragmentInURI 54 External ID contains fragment part xmlcBadExternalDTD 55 Out of syntax in external DTD xmlcLeftBracketExpected 56 [ missing xmlcBadInclude 57 Out of syntax in INCLUDE conditional section xmlcUnlimitedIgnore 58 IGNORE section did not end before end of file xmlcBadConditional 59 Neither INCLUDE nor IGNORE was found after <![ xmlcBadContent 60 Out of syntax in external element content xmlcUnlimitedElementDecl 61 ">" pairing "<!ELEMENT" not found
Constants
Page 123-20
VK_MENU VK_PAUSE VK_CAPITAL VK_KANA VK_HANGEUL VK_HANGUL VK_JUNJA VK_FINAL VK_HANJA VK_KANJI VK_ESCAPE VK_CONVERT VK_NONCONVERT VK_ACCEPT VK_MODECHANGE VK_SPACE VK_PRIOR VK_NEXT VK_END VK_HOME VK_LEFT VK_UP VK_RIGHT VK_DOWN VK_SELECT VK_PRINT VK_EXECUTE VK_SNAPSHOT VK_INSERT VK_DELETE VK_HELP VK_LWIN VK_RWIN VK_APPS VK_NUMPAD0 VK_NUMPAD1 VK_NUMPAD2 VK_NUMPAD3 VK_NUMPAD4 VK_NUMPAD5 VK_NUMPAD6 VK_NUMPAD7 VK_NUMPAD8 VK_NUMPAD9 VK_MULTIPLY VK_ADD VK_SEPARATOR VK_SUBTRACT VK_DECIMAL VK_DIVIDE VK_F1 VK_F2 VK_F3 VK_F4 VK_F5 VK_F6 VK_F7 VK_F8 VK_F9 VK_F10 VK_F11 VK_F12 VK_F13 VK_F14 VK_F15 VK_F16 VK_F17
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
012h 013h 014h 015h 015h 015h 017h 018h 019h 019h 01Bh 01Ch 01Dh 01Eh 01Fh 020h 021h 022h 023h 024h 025h 026h 027h 028h 029h 02Ah 02Bh 02Ch 02Dh 02Eh 02Fh 05Bh 05Ch 05Dh 060h 061h 062h 063h 064h 065h 066h 067h 068h 069h 06Ah 06Bh 06Ch 06Dh 06Eh 06Fh 070h 071h 072h 073h 074h 075h 076h 077h 078h 079h 07Ah 07Bh 07Ch 07Dh 07Eh 07Fh 080h
Constants
Page 123-21
VK_F18 VK_F19 VK_F20 VK_F21 VK_F22 VK_F23 VK_F24 VK_NUMLOCK VK_SCROLL VK_LSHIFT VK_RSHIFT VK_LCONTROL VK_RCONTROL VK_LMENU VK_RMENU VK_PROCESSKEY VK_ATTN VK_CRSEL VK_EXSEL VK_EREOF VK_PLAY VK_ZOOM VK_NONAME VK_PA1 VK_OEM_CLEAR
= = = = = = = = = = = = = = = = = = = = = = = = =
081h 082h 083h 084h 085h 086h 087h 090h 091h 0A0h 0A1h 0A2h 0A3h 0A4h 0A5h 0E5h 0F6h 0F7h 0F8h 0F9h 0FAh 0FBh 0FCh 0FDh 0FEh
Macintosh The virtual keycodes on Macintosh depend on the keyboard layout. There are no predefined constants.
Constants
Page 123-22
338 360 361 363 364 365 368 371 380 381 382 383 385 387 393 394 400 402 419 422 423 424 425 429 430 432 438 440 442 443 445 446 447 448 449 450 451 452 453 454 455 457 458 459 460 461 480 481 482 483 484 485 486 520 521 735 744 746 31001 31004 31018 31027 31032 Error handling
ActiveX component did not run correctly Object already loaded Can't load or unload this object ActiveX control specified not found Object was unloaded Unable to unload within this context The specified file is out of date. This program requires a later version The specified object can't be used as an owner form for Show Invalid property value Invalid property-array index Property Set can't be executed at run time Property Set can't be used with a read-only property Need property-array index Property Set not permitted Property Get can't be executed at run time Property Get can't be executed on write-only property Form already displayed, can't show modally Code must close topmost modal form first Permission to use object denied Property not found Property or method not found Object required Invalid object use ActiveX component can't create object or return reference to this object Class doesn't support Automation File name or class name not found during Automation operation Object doesn't support this property or method Automation error Connection to type library or object library for remote process has been lost Automation object doesn't have a default value Object doesn't support this action Object doesn't support named arguments Object doesn't support current locale setting Named argument not found Argument not optional or invalid property assignment Wrong number of arguments or invalid property assignment Object not a collection Invalid ordinal Specified DLL function not found Code resource not found Code resource lock error This key is already associated with an element of this collection Variable uses a type not supported in Basic This component doesn't support events Invalid Clipboard format Specified format doesn't match format of data Can't create AutoRedraw image Invalid picture Printer error Printer driver does not support specified property Problem getting printer information from the system. Make sure the printer is set up correctly Invalid picture type Can't print form image to this type of printer Can't empty Clipboard Can't open Clipboard Can't save file to TEMP directory Search text not found Replacements too long Out of memory No object Class is not set Unable to activate object Unable to create embedded object
Page 124-2
31036 31037
Pythagoras errors
The following runtime errors may be raised by accessing Pythagoras properties and methods : 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 Unknown Error No document Invalid or not existing document No object Invalid or not existing object Operation impossible on protected object This object does not have comment Too many layers Invalid value for a group id Object has invalid style Style can not be added to the document or is unknown Angle is not in the first positive or negative circle Not enough memory to do this operation Endpoints must be point objects Endpoints contain the same point Associated objects must be in the same overlay File has not been saved !!! Invalid or missing parameters File has not been saved !!! Not enough resources available to load drawing in memory. Protection dongle present ? Can't open new drawing. Not enough resources available to load drawing in memory Save As necessary This function is NOT supported in the read-only version File is not saved ! Creating the file failed Invalid filename This document can not be saved in the selected file format Error during close of document File is already opened Document not closed correctly This file is not a Pythagoras file Invalid version. This file can not be edited with the current version of Pythagoras. Inconsistency in drawing. Impossible value for a vertical angle Selections in both overlays simultaneous not allowed Protected Layers can not be modified At least one object has a invalid display level ( <-10 or > 10). Several objects could not be deleted, they are still used by a polygon or path. Delete the polygon or path first. Several objects could not be deleted, they are still used by other objects. Delete the other objects (Polygons, Paths, Coordinate Systems, ...) first. A point could not be deleted. It is used by a Coordinate System. Delete the Coordinate System if you want to delete the point(s). Not all points could be deleted. They are used by a polygon or path. Delete the polygon or path first if you want to delete the points. An arc could not be deleted. The arc is used by a polygon or path. Delete the polygon or path if you want to delete the arc(s). A circle could not be deleted. The circle is used by a polygon or path. Delete the polygon or path if you want to delete the circle(s). Can not add a new symbol. Not enough resources available to load drawing in memory. Paste from Local CS to Page CS is not possible Default layer is protected
Error handling
Page 124-3
1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109
Invalid type of Coordinate system. Unknown Error Unknown Error Unknown Error Not enough free layers to paste or import the data.\n\nGroup layers. Unknown Error These points are not on a circle The parameters do not form a valid Clothoid Too many points for one curve Too many objects for one polygon or path These objects do not form a valid polygon or path Invalid style this type of TIFF file is not supported Unknown or not supported image format Coordinate system in wrong overlay ** Unknown Coordinate system Nr of user coordinate systems is limited to 32. Can not allocate a new CS These points can not form a coordinate system Invalid scale factor for layer Can not allocate new layer anymore. Active group must contain the default layer Can not allocate a new group anymore. Can not delete the active group. Invalid string for symbol name Invalid string for symbol group Symbol is not in library Symbol can not be removed Layer name already exists Drawing is not on top. Method may only be used in Mouse Event Macro Method may only be used in Keyboard Event Macro Calculation of the Cross section failed Array overflow Too many points to calculate the cross section Invalid text file. Save As necessary This file is too large to be opened by the Pythagoras Editor. Serial communication : access denied CadObjects refer to different documents Coordinate System in wrong document Object is not editable This document can not be added as as subdocument. Too many layers. ODBC Error Invalid "Data collector" file Sheet with given name already exists The name of the main document may not be the same as the name of one of its subdocuments. View with given name already exist. Zoomfactor: invalid value. (0.0 <= f <= 1.0). Can't import or export in Page Coordinate System Associated objects must be in page CS Associated objects must be in the same sheet Special paste operations can not be combined with transformations between projection systems Databases from main document and a subdocument cannot be merged Intertable references are dropped Unknown Coordinate Reference System Tie Point Set not found Drawing can not be saved: a thematic map can not be converted Inconsistent image file The parameters do not form a valid circle Geographical coordinate systems can not be assigned to documents Changing the Coordinate Reference System is only possible if the drawing does not contain Georeferenced Web services
Page 124-4
Error handling
1110 1111
Can not add the new User Default. User Default with same name already exists Warning : A name conflict between Web Services Definitions of the document and the library is detected. The Web Services of the document are automatically renamed.
1401 .. 1410 : File errors 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 Illegal filename File with given name not found File already exists Hardware error No more room on device File is locked Operating upon unopened file Read attempted after EOF/EOL Position outside file unknown error
1500 .. : Other errors 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 Error handling Error found during Validation of drawing. Automatic repair failed. Invalid Parameter Color Property not applicable for this object type Wrong object type or object is not allocated Conversion of string to REAL value failed String is too short Invalid array parameter passed String is too long String is missing String contains invalid characters Not enough memory for this operation Comment Property not applicable for this object type This combination of attributes is impossible Invalid index for submenu item Invalid index for menu item The maximum number of user menu items is exceeded The maximum number of user submenus is exceeded The maximum number of submenu items is exceeded Submenu items can only be added to popup menu items New timer can not be started Connection to ODBC data source failed Database option is not supported An actual variant argument has improper type An actual variant argument belongs to an improper class Obsolete A database table is dropped A database table column is dropped Too large value for DBColumn.PendingAction property specified A table row(s), not a query row(s) is required A row is deleted from the table A query is dropped A CAD object is linked to other table Wrong table type specified Objects belong to different overviews A row belongs to other table A column belongs to other table ObjectTypes value is wrong CAD Object belongs to other document than database row Invalid Document Type of constant to compare with differs from column type Comparison operator contradicts column type Document containing executing macro can not be closed A non-VBA expression has bad syntax or result type
Page 124-5
1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576
Macro not found An object cannot be included to a compound because it has improper type An object cannot be included to a compound because it is linked to the database Specified number is not a compound identifier Objects belong to different documents Objects belong to different overlays No permission to use VBA function DB table column index was dropped, position is lost Coordinate Reference Systems are not correlated Invalid Overlay The parameters of the method refer to different documents Insufficient number of points or all points are collinear There are 2 or more points with the same coordinates Triangulation can not be calculated Objects belong to different sheets Operation not possible on object that is not horizontal Can't import or export in Page Coordinate System Export shape failed Invalid KML Element type This operation can be applied only to a queue of items of an element Current item of queue is undefined Input matrix has wrong dimensions for this type of operation Pythagoras database is already closed An erratic definition of a base rowset A query is CAD object linked A query is not CAD object linked This operation can be applied only to a document database This operation can be applied only to a Pythagoras database A query row(s), not a table row(s) is required here A row is not more present in a query This opertaion can be applied only to a simple or an extension query This opertaion can be applied only to an aggregation query Specified object type set does not correspond to any system table Some data in the array have different type. Sorting is not possible
2001 .. : Database inconsistencies 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 Error handling Type not supported Bad table, view or column name CAD object type specified is not allowed in databases No source object specified to do operation Table structure is protected Dictionary table cannot reference CAD objects A document is sleeping or outside of an overview A document is read only A document is not main overview one An object belongs to protected layer Value type does not match column type Maximum < minimum in column definition Default < minimum in column definition Default > maximum in column definition Referencing and referenced columns have different types Referenced table is not a dictionary Table reference is outside the database Minimum or Maximum specified for a column whose type does not permit this A table or query does not contain a column with such number A table or query does not contain a column with such name A column is not changeable Pending reference action cannot be set to NULL because it contradicts other column properties NULL value is prohibited for a column Value to assign < Minimum
Page 124-6
2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2043 2044 2045 2046 2047 2048 2049 2050 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 Error handling
Value to assign > Maximum Reference to a CAD object that does not exist Reference to a row that does not exist Column number repeated in the value list Insert aborted because of not all mandatory values are specified A set of allowed CAD object types must be empty for a non-attribute table A set of allowed CAD object types must be non-empty for an attribute table CAD object cannot be linked to a table because of its type is not allowed for the table CAD object already linked to the database A column cannot be added or renamed because there is already a column with such name in the table or in the query Maximum number of queries in the database exceeded Maximum number of column in the table or in the query exceeded A document does not contain a table with such number A document does not contain a table with such name A row value cannot be converted to new type Minimum cannot be changed because of column data Maximum cannot be changed because of column data Default value does not refer to existing row A column cannot be added because the table is not empty and the column has no default A non unique value column cannot be referenced Column cannot be deleted because it is referenced Maximum number of tables in the database exceeded Table type cannot be changed A table cannot be added or renamed because there is already a table with such name in the database Set of allowed CAD object types cannot be changed because a table would be linked with CAD objects of not allowed types Table cannot be deleted because it is referenced A table cannot be copied to another document because of undefined table reference A table cannot be copied to another document because of undefined column reference A document does not contain a sheet with such name A database cannot be copied to itself An operation cannot be applied to an attribute table An operation cannot be applied to a dictionary table A query being a base of another query is deleted A view cannot be based on a temporary query Database is locked Operation cannot be executed because dongle database option is off Attempt to do index operation by column not indexed Data cannot be copied because tables have different structure Table couldn't be added because table with such name exists and has different structure Tables couldn't be added to Clipboard because they have wrong references A column of not CAD object type defined with some CAD object type allowed A column of CAD object type defined with no CAD object type allowed CAD object cannot be column default value A unique value column cannot contain repeating values Such value is already present in a unique value column A table cannot be created without name A column cannot be created without name Table data are read protected Table data are write protected Invalid table access rights code A column of an attribute table cannot be declared a unique value one Type of referenced column cannot be changed Pending action for CAD object referencing column cannot be set to ptPendingLeave Subdocuments have different lock names or passwords, unlocking is impossible Lock name is absent, but lock password is present Lock name is present, but lock password is absent Wrong name or password Not NULL default in a unique value column Object referencing column cannot be neither indexed nor unique Real type column cannot be declared unique
Page 124-7
2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102
A temporary query is probably deleted A database does not contain a view with such name A view cannot have empty name A row iterator is discontinued (table, query or column is deleted or index is destroyed Attempt to make reciprocal references between columns A temporary query cannot have name MayBeNull for CAD object referencing column cannot be set to FALSE Condition contains incompatible data Type mismatch in expression Bad code of built-in function in condition definition Attempt to do operation with invalid query Attempt to do operation with dropped table or query An attempt is made to link an object of the page overlay to the database An attempt is made to link an element of compound to the database The operation cannot be applied to a document database The operation can be applied only to a document database
2500 .. : Coordinate Reference Systems 2512 2513 2514 2515 Transformation of coordinate in Coordinate Reference System failed: outside domain of CRS .... : input not in valid range for geographical coordinates .... : DLL is missing .... : Calculation failed
2600 .. : Stack Errors 2600 2601 2602 Stack not initialized Stack underflow Stack overflow
2700 .. : Queue Errors 2700 2701 2702 Queue not initialized Queue underflow Queue overflow
2800 .. : Tree Errors 2800 2801 An entry in the tree with the same Value Index pair already exists Data with the given key is not found in the tree
Error handling
Page 124-8
Description By default arrays start with index 0. Option Base allows to start indexing from 1. Example
Option Base 1
Description Sets the default for comparing strings. By default the comparing method = Binary. Example
Option Compare Text
MSCompatible Syntax
Option MSCompatible
Description This option is introduced in Pythagoras 11. Previous versions of Pythagoras VBA were incompatible in a number of cases with Microsoft VBA. For Pythagoras 11.0x, it was recommended to insert this statement in the first line of every module. Since 11.10 we recommend to remove the option MSCompatible. In that case when using a variable in parantheses in a procedure call and the parameter is ByRef, you will get the message: "Ambiguous usage of variable in pararenthesis in procedure call". When you want to use, this "dangereous" feature of VBA, you have to use Option MSCompatible. Example
Option MSCompatible
Special values
The values Nothing, Empty and Null are predefined. All 3 values mean absence of meaningful value.
Page 9
Nothing Description This value may be assigned to a variable of any Object type or of a Variant type. If a variable = Nothing, this means that the variable does not reference to an object. Rules The operators "=" and "<>" may not be used to compare object with Nothing. See example on how to check if variable = Nothing.
Example
Empty Description A variable of type Variant is always assigned to Empty after declaration. If a variable = Empty, this means that no value has been assigned to the variable yet. An attempt to do any operation with a variable with value = Empty raises an exception. Rules The value Empty may only be assigned to a Variant type. To determine if a variable of type Variant is intialised, the function IsEmpty must be used. Example
Dim V As Variant V = Empty If IsEmpty(V) Then End If
Null Description Null value indicates that the variable of type Variant does not contain any valid data. In Pythagoras Null value is mainly used when handling database data. Rules Null may only be assigned to a Variant type. To determine if a value of a variable is valid, the function IsNull must be used. Example
Dim V As Variant V = Null If IsNull(V) Then End If
Operators
Arithmetic Operators List + : addition
Page 10
- : subtraction / : division: returns a double (floating point) * : multiplication \ : integer division: returns integer result Mod : modulo ^ : exponent String Operators List
& : concatenation
Comparison Operators List > : greater than < : less than <> : not equal >= : greater than or equal <= : less than or equal = : equal Logical Operators List And : logical AND Or : logical OR Xor : logical XOR Not : logical negation Eqv : logical equivalence Imp : logical implication
Variable Declaration
Const Description Declares a constant. Hexadecimal, octal or binary values must be preceded respectively by &H, &O and &B Example
Const pi = 3.1415926535897932 Const GL_FOG = &H00B60 Const BinaryTen = &B1010
Dim Syntax
[Public | Private] Dim varname[(subscripts)] As type. typeis one of the following data types: Boolean, Byte, Date, Double, Integer, Long, Single, String, Error, Variant, User-Defined type.
Description Declares a local or global variable. Only global variables may have the keyword Public or Private. A dynamic array has only one dimension. Multi-dimensional arrays have a fixed dimension for each subscript. Example
Dim Str As String, B As Boolean. Dim A1D(10 To 20) As Integer Dim A3D(2,5,3) As Double
Page 11
Dynamic array String of 24 bytes 32-bit Integer variant type Date type
' Returns upper-bound of Names ' Set value = hex FF = 255. ' &O37 Octal = &B11111 binary.
ReDim Syntax
ReDim [Preserve] varname[(subscripts)]
Description Resizes and reallocates storage space for a dynamic array. Must be used within a procedure (Sub or Function). Example
Sub DyArray Dim Names() As String ReDim Names(1 To 5) Names(1) = "My name" ' Dynamic array
Page 12
Description Declares a procedure. - Public is the default - ByRef is the default method of passing parameters. When the Optional keyword is used, all the arguments that follow must also be optional. Example
Private Sub Test(P1 As Long, ByVal P2 As Double, _ Optional ByVal TestEqual As Boolean = True, _ Optional ByVal Value As Double = 0.1)
End Sub ' Valid ways of calling Sub with optional parameters Sub CallTest Test 5, 1.2 Test 5, 1.2, False, 0.2 Test 5, 1.2, Value:=0.3 ' Named parameter Test 5, 1.2, , Value:=0.3 ' Omitted parameter + named parameter End Sub
Function Syntax
[Public | Private] Function name[(arglist)] As Type [statements] [name = expression] [Exit Function] [statements] [name = expression] End Function arglist : a comma-delimited list of parameters each having the following syntax : [ByVal | ByRef] varname[()] As Type [= defaultvalue]
Description Declares a function. - Public is the default - ByRef is the default method of passing parameters. Example
Private Function Max(ByVal P1 As Double, ByVal P2 As Double) As Double
Page 13
End Function
Description Calls a procedure (Sub). When the procedure contains optional arguments Named parameters may be used. When a parameter is between brackets (see last example), it is considered an expression. Examples
'Example 1 Function Max(P1 As Double, P2 As Double, _ Optional P3 As Double = ptMinDouble, _ Optional P4 As Double = ptMinDouble) As Double If P3 = ptMinDouble Then Max = Max(P1, P2) Elseif P4 = ptMinDouble Then Max = Max(Max(P1, P2), P3) Else Max = Max(Max(Max(P1, P2), P3), P4) End If End Function Sub TestMax Dim V As Double, V1 As Double, V2 As Double, V3 As Double, V4 As Double V = Max(V1, V2) V = Max(V1, V2, V3) V = Max(V1, V2, V3, V4) End Sub 'Example 2 Sub Test(ByRef V1 As Long, _ Optional ByVal Min As Long = -100, _ Optional ByVal Max As Long = 100) End Sub Sub CallUsingNamedArguments Test 10, Max := 99, Min := -10 End Sub Sub CallUsingExpression Dim V As Long V = 123 Test (V), 3.0 End Sub
Page 14
Exit Syntax
Exit Exit Exit Exit Do For Function Sub
Page 15
Examples
Dim i As Long Dim Names() As String Redim Names(1 To 10) For i = LBound(Names) to UBound(Names) GetName(i, Names(i) Next i
Page 16
End With
Description Performs a set of assignments and executes other code against a particular object or userdefined type. Examples
Type tContactPerson Name As String Index As Long End Type Dim Contacts(1 To 10) As tContactPerson With Contacts(1) .Name = "Fred Flintstone" .Index = 1 End With
Description Converts expression to a Boolean data type. Expressions that evaluate to 0 are converted to False (0), and expressions that evaluate to nonzero values are converted to True (-1) Examples
Dim B As Boolean B = CBool("0") ' returns False
CByte Syntax
CByte(expression)
CDbl Syntax
CDbl(expression)
Description Converts expression to a Double data type. Expression may also be of type Date. Examples
Dim D As Double Dim i As Integer D = CDbl("20.5") D = CDbl(i) ' returns the value 20.5 in B ' Converts integer value i to Double
Page 17
CInt Syntax
CInt(expression)
CLng Syntax
CLng(expression)
CSng Syntax
CSng(expression)
CStr Syntax
CStr(expression)
Description Converts expression to a String data type. When expression contains a date, the resulting string will contain the date always in the format "yyyy-MM-dd". Examples
Dim S As String S = CStr(-123.56) ' returns the string "-123.56" in S
CDate Syntax
CDate(expression)
Description Converts expression to a Date data type. The expression must be of type string. The string must have the format "yyyy-MM-dd". Unlike MS VBA, the Pythagoras CDate format is fixed and does not depend on the locale settings of the computer. Examples
Dim D As Date Dim S As String
Page 18
S = "2005-08-10" D = CDate(S)
CVErr Syntax
CVErr(errornumber)
Description Returns a variant type containing a string. The string = "Error < errornumber>". Examples
Dim V As Variant Dim S As String V = CVErr(123) S = V
Fix Syntax
Fix(expression)
Int Syntax
Int(expression)
Description Removes the fractional part expression if the value is positive. For negative values, Int returns the first negative integer less than or equal to expression. Examples
Dim D As Double D = Int(-123.56) ' returns -124 in D
Round Syntax
Round(Expression, NumberOfDecimalPlaces)
Str Syntax
Str(expression)
Page 19
S = Str(-123.56)
Val Syntax
Val(expression)
Description Converts a string representation of a number into a numeric data type. (Integer, Long, Single, Double) Examples
Dim D As Double D = Val("-123.56") ' returns the string "-123.56" in D
Err Object
Clear Syntax
Err.Clear
Description Syntax
Err.Description
Description The Description property sets or returns a description of the runtime error. Examples
MsgBox "Runtime error : " & Err.Description
Number Syntax
Err.Number
Description The Number property sets or returns the number of the runtime error. The error numbers raised by Pythagoras VBA and Pythagoras Object Model are described in the section Error Handling. Examples
MsgBox "Runtime error : " & Err.Number & vbCrLf & Err.Description
On Error Syntax
On Error GoTo Label
or or
Description
On Error GoTo Label: When a run-time error occurs, program execution will continue
at Label.
Page 20
On Error GoTo 0 : Error handling is disabled until the next On Error statement is
executed.
On Error Resume Next : When a run-time error occurs, program execution continues
with the statement following the statement that caused the error. Examples
Raise Syntax
Err.Raise Number, Source, Description, HelpFile, HelpContext
Description The Raise method raises a runtime error. Number : Long Source : String Description : String HelpFile : String HelpContext : Long Examples
Err.Raise 125, "My program", "Invalid data", "", 0
Resume Syntax
Resume Resume Next Resume Label
Description The Resume statements are used to continue execution after error handling. 1. Resume : a) The error-handling routine is in the same procedure as the statement that caused the error: Program resumes (goes back to) the statement that caused the error. b) The error occurred in a procedure called by the procedure containing the error handling: Program resumes (goes back to) the statement in the procedure containing the error handler that called the external procedure. 2. Resume Next a) The error-handling routine is in the same procedure as the statement that caused the error: Program continues with the statement following the statement that caused the error. b) The error occurred in a procedure called by the procedure containing the error handling: Program continues with the statement in the procedure containing the error handler immediately following the statement that called the external procedure. 3. Resume Label Program continues at the specified label. Label must be in the same procedure as the error handler. Examples
On Error GoTo ErrorHandle B = 0.0 C = A/B If C = ptMaxDouble Then ' Division by 0 End If
Page 21
Source Syntax
Err.Source
Description The Source property sets or returns the source (String) of the runtime error. The error numbers raised by Pythagoras VBA and Pythagoras Object Model return as source "1" Examples
MsgBox "Runtime error : Source = " & Err.Source
File Handling
FreeFile Syntax
FreeFile
Open Syntax
Open FileName For mode [Access access] [lock] As [#]FileNumber, [Len=RecLength]
Description Opens an existing file or creates a new file. mode : Append, Binary, Input, Output or Random access : Read, Write or ReadWrite lock : Shared, Lock Read, Lock Write or Lock Read Write A new file is created if FileName does not exits and mode : Append, Binary, Output or Random. Examples
Type tRecord ClientNumber As Integer Name As String * 24 Country As String * 24 End Type Dim Record As tRecord Open FileName1 For Random As 2 Len = Len(Record) Open FileName2 For Input As 3 Open FileName3 For Random Access Read Shared As 4 Len = Len(Record)
Page 22
Close Syntax
Close [FileNumber]
Description The Close statement closes the file opened with the Open statement. Examples
Close #2
Reset Syntax
Reset
Description Closes all files opened with the Open statement. Examples
Reset
Print Syntax
Print #FileNumber, [outputlist]
Description Writes formatted data to a file that is opened for append or output. Examples
' Output the string "Hello World i= 10" i = 10 Print #2, "Hello"; Spc(2); "World"; Tab(20); "i="; i
Description Reads one line from a file and assigns it to as String variable. Examples
Dim Str As String Line Input #1, Str
Write Syntax
Write #FileNumber, [outputlist]
Description Writes structured data to a file that is opened for append or output. The counterpart of the Write statement is the Input statement. Examples
Dim Str1 As String Write #1, 1234, 12.34, True, Str1 Write #1, to the file
Input Syntax
Input #FileNumber, [inputlist]
Page 23
Put Syntax
Put FileNumber, [record], Data
Description Writes data from a program variable to a file opened in random or binary mode. The counterpart of the Put statement is the Get statement. Examples
Type tRecord ClientNumber As Integer Name As String * 24 Country As String * 24 End Type Dim Record As tRecord Open FileName For Random As 2 Len = Len(Record) Put #2, 15, Record ' Writes record 15 Put #2, , Record ' Writes next record (nr 16)
Get Syntax
Get FileNumber, [record], Data
Description Returns the current position in the open file. If the file was opened in random mode, the number returned by the Seek function refers to the next record to be written or read. In all other modes (append, binary, input and output), the number returned by the Seek function is the byte position at which the next read or write operation starts. Examples
Pos = Seek(2)
Page 24
Description Sets the current position in the open file. If the file was opened in random mode, Position refers to the next record to be written or read. In all other modes (append, binary, input and output), Position is the byte at which the next read or write operation starts. Position must be > 0. Examples
Seek #2, 15
Lock Syntax
Lock [#]FileNumber[, RecordRange]
Unlock Syntax
Unlock [#]FileNumber[, RecordRange]
Kill Syntax
Kill FileName
Description Deletes one or more files/folders. The file name may contain wild characters (?, *) Examples
Kill FileName Kill C"\temp\*.doc"
Loc Syntax
Loc(FileNumber)
Description Returns the position in the file. - If the file is open in random mode, Loc returns the record number in the file. - If the file is open in input or output mode, Loc returns the current byte position in the file divided by 128. - If the file is open in binary mode, Loc returns the current byte position. Examples
Pos = Loc(2)
Page 25
Eof Syntax
Eof(FileNumber)
Lof Syntax
Lof(FileNumber)
FileAttr Syntax
FileAttr(FileNumber, 1)
Description The file access mode is returned as a long integer: Input :1 Output : 2 Random : 4 Append : 8 Binary : 32 Examples
Type tRecord ClientNumber As Integer Name As String * 24 Country As String * 24 End Type Dim Record As tRecord Open "test.bin" For Random As 1 Len = Len(Record) If FileAttr(1, 1) <> 4 then ' failure "FileAttr()" End If
FileCopy Syntax
FileCopy FileName, FileName
FileLen Syntax
FileLen(FileName)
Page 26
Dir Syntax
Dir[(PathName[, Attributes])]
Description Returns a string containing the name of a file or directory that matches a specified path name and file attributes. PathName: is a string expression that may specify a drive, a directory, and a file name. The wildcard characters * and ? may be used to specify multiple files/directories. Attributes: is a constant or numeric expression specifying file/directory attributes to be matched. This can be a sum of several attribute constants specified below. If the argument Attributes is omitted, vbNormal is supposed. The attribute constants are: vbNormal vbReadOnly vbHidden vbSystem vbVolume vbDirectory :0 :1 :2 :4 :8 : 16 files without attributes. readonly files/directories. hidden files/directories. system files/directories. volume label. Other attributes will be ignored. directories.
Dir returns the first file name that matches pathname and attributes. To get additional matched file names the function should be called again without arguments. When no more file names match, an empty string ("") is returned. In this case, the next call of Dir must specify the argument Pathname, otherwise the runtime error 5 ("Invalid procedure call or argument") will result. Examples
Message all hidden system files with extension ".txt" in the directory C:\Temp Dim S As String S = Dir("C:\Temp\*.txt", vbHidden+vbSystem) Do While S <> "" MsgBox S S = Dir Loop
MkDir Syntax
MkDir PathName
Description Creates a directory with the specified path name. PathName: is a string expression that may specify a drive, a directory, and a file name. Examples
MkDir "C:\Temp"
Interaction Functions
InputBox Syntax
InputBox(prompt[, title] [, default] [, xpos] [, ypos])
Page 27
Description InputBox returns a string containing the contents of the edit field. Prompt : the text of the message to be displayed in the message box. Title : The title of the message box. Default : The default value in the input field. xpos, ypos : Position of the input box on the screen. (Windows only) Examples
InputStr = InputBox("Enter 23", "My Title", "32")
Description Prompt : the text of the message to be displayed in the message box. Buttons : the sum of the Button, Icon, Default Button, and Modality constant values. For more information see chapter Constants. Title : The title of the message box. If used as a function, MsgBox returns one of the following values : vbOk, vbCancel, vbAbort, vbRetry, vbIgnore, vbYes, vbNo. Examples
If MsgBox("Error. Continue?", vbYesNo+vbQuestion, "Title") = vbYes Then End If MsgBox "This message is generated by the VBA Manual", _ vbOkOnly+vbExclamation+vbApplicationModal, "VBA Manual"
Math Functions
Abs Description Returns the absolute value of a given number. Atn Description Returns the arctangent of a given number. Cos Description Returns the cosine of a number. Exp Description Returns the base of the natural logarithm raised to a power. Log Description Returns the natural logarithm of a number. Sgn Description Returns -1 if expression is negative, and returns +1 if expression is positive.
Page 28
Sin Description Returns the sine of a number. Sqr Description Returns the square root of a number. Tan Description Returns the tangent of a number.
String Manipulation
Asc Syntax
Asc(String)
Description Returns the integer value of the first character of the string. Examples
Dim i As Integer i = Asc("ABC") ' i = 65
Chr Syntax
Chr(Integer)
Format Syntax
Format(expression[, format])
Description Format converts expression to a string. Format, is a valid name (eg "Fixed") or a userdefined format. Expression : Any numeric expression. (E.g. V1 * V2 / 0.5). Format : Predefined formats : General Number, Currency, Fixed, Standard, Percent, Scientific, Yes/No, True/False, On/Off Examples : 3.E+02 5.62E+05 Format(562486.2356, "Standard") 562,486.24 Characters that create user-defined number formats : returns Format(300.123, "Scientific") Format(562486.2356, "Scientific") returns returns
Page 29
(0) : Digit placeholder. If expression contains a digit in the appropriate position, the digit is display. otherwise a 0 is displayed. Example : Format(1.316, "00.00")returns 01.32 (#) : Digit placeholder Example : Format(1.316, "##.##")returns 1.32 (.) : Decimal placeholder. Pythagoras VBA always displays a ".", in contrast to standard VBA where the actual character depends on the international settings of the Windows system. (,) : Thousands separator. Pythagoras VBA always displays a ",", in contrast to standard VBA where the actual character depends on the international settings of the Windows system. (%) : Percentage placeholder Example : Format(0.31, "##.##%")returns 31.00% (E- E+ e- e+) : Scientific format Examples : Format(300.123, "##.##E+")returns 30.01E+01 Format(300.123, "##.##E-")returns 30.01E01 - + $ ( ) : Displays a literal character. Example : Format(300.123, "(000.00)") returns (300.12) \ : The character following the backslash is displayed as a literal character. Example : Format(300.123, "000.00\ \!") returns 300.12 ! Predefined date and time formats : General Date, Long Date, Medium Date, Short Date, Long Time, Medium Time, Short Time. Characters that create user-defined date and time formats : c : Displays date and/or time. d : The day as a number without a leading zero (1..31) dd ; The day as a number with a leading zero (01..31) ddd : The day as an abbreviation (Sun..Sat) dddd : The day as a full name (Sunday..Saturday) ddddd : Short day format based on computer settings. dddddd Long day format based on computer settings. w : The day of the week. (1..7). 1 = Sunday ww : The week of the year. (1..54) m : The month without leading zero (1..12) mm : The month with leading zero (01..12) mmm : The month as an abbreviation (Jan..Dec) mmmm : The name of the month (January..December) q : The quarter of the year (1..4) y : The day of the year (1..366) yy : The year (00..99) yyyy : The year. Eg. 2004. h : The hour without leading zeros (0..23) hh : The hour with leading zeros (00..23) n : The minutes without leading zeros (0..59) nn : The minutes with leading zeros (00..59) s : The seconds without leading zeros (0..23) ss : The seconds with leading zeros (00..59) AM/PM : the 12-hour clock using uppercase AM and PM. am/pm : the 12-hour clock using lowercase am and pm. A/P : the 12-hour clock using uppercase A or P (for AM/PM) a/p : the 12-hour clock using lowercase a or p (for am/pm) ttttt : the long time format based on computer settings. Example :
Format(#2000-01-01 00:00:00#, "dd-mm-yyyy = dddd mmmm d yyyy hhnn-ss")
Page 30
Description Returns the starting position of StringToFind in StringToSearch. If the string is not found the value 0 is returned. Start argument must be given if CompareMode argument is present. Examples
Dim Pos As Long Pos = InStr(1, "1234ABC890", "abc", vbTextCompare)) Pos = InStr(1, "1234ABC890", "abc", vbBinaryCompare)) ' Pos = 5 ' Pos = 0
InStrRev Syntax
InStrRev(StringToSearch, StringToFind [,start [, CompareMode]])
Description Returns the ending position of StringToFind in StringToSearch. Searching is performed from right to left. If the string is not found the value 0 is returned. If Start position is not specified the value of -1 is assumed, which means that the search begins at the last character. Start argument must be given if CompareMode argument is present. Examples
Dim Pos As Long Pos = InStrRev("C:\Work\Projects\BigRoad.PYT", "\") Pos = InStrRev("C:\Work\Projects\BigRoad.PYT", "\", 16) ' Pos = 17 ' Pos = 8
LCase Syntax
LCase(String)
Left Syntax
Left(string, length)
Len Syntax
Len(string | VarName)
Description Returns the number (long) of characters of string, or the size of VarName.
Page 31
Examples
LTrim Syntax
LTrim(StringExpression)
Description Removes all leading spaces from StringExpression and returns the result in a string. Examples
S = LTrim(" ABC" & "DEF") ' Returns "ABCDEF"
Description Returns a substring of string eventually with the given length. Examples
S = Mid("1234567890", 5, 3) S = Mid("1234567890", 5) ' Returns "567" ' Returns "567890"
Right Syntax
Right(string, length)
Description Returns a string containing the rightmost length characters of string. Examples
S = Right("1234567890", 5) " S becomes "67890"
RTrim Syntax
RTrim(StringExpr)
Space Syntax
Space(n)
Page 32
Examples
Spc Syntax
Spc(n)
StrComp Syntax
StrComp(string1, string2[, compare])
Description Compares string1 and string2 and returns the result. Returns value: string1<string2 : -1 string1 = string2 : 0 string1>string2 : 1 compare : vbBinaryCompare (default) or vbTextCompare. Note the =, < and > operators may be used with Strings. E.g. If S1 > S2 Then End If Examples
Dim i = i = 1. i = i As Integer StrComp("Hello", "HELLO", vbTextcompare) StrComp("Hello", "Hello2") StrComp("z", "A")
String Syntax
String(number, character)
Tab Syntax
Tab(Collumn)
Description Moves the text insertion point to the given column. May only be used in expressions in a Print statement. Examples
Print #1, Tab(10); "Value 1"; Tab(20); i
Trim Syntax
Trim(StringExpr)
Page 33
Examples
S = Trim("
ET Phone Home
")
UCase Syntax
UCase(String)
Date functions
Date literals The following formats are supported :
#yyyy-MM-dd hh:mm:ss.sssssss# #yyyy-MM-dd hh:mm:ss.ssssss# #yyyy-MM-dd hh:mm:ss.sssss# #yyyy-MM-dd hh:mm:ss.ssss# #yyyy-MM-dd hh:mm:ss.sss# #yyyy-MM-dd hh:mm:ss.ss# #yyyy-MM-dd hh:mm:ss.s# #yyyy-MM-dd hh:mm:ss# #yyyy-MM-dd hh:mm# #yyyy-MM-dd hh# #yyyy-MM-dd#
Date Syntax
Date
DateAdd Syntax
DateAdd(interval, number, date)
Description Returns a date as variant. interval : indicates the meaning of number. The interval must be a string. Valid values: "yyyy" = Year" "q" = Quarter "m" = Month "y", "d", "w" = Days "h" = Hours "n" = Minutes "s" = Seconds number : the number of days, hours, minutes or seconds added to the date. date : the input date. Examples
Dim D As Variant
Page 34
D = DateAdd("yyyy", 1, #2000-01-01 00:00:00#) D = DateAdd("q", 1, D) D = DateAdd("m", 1, D) D = DateAdd("y", 1, D) D = DateAdd("ww", 1, D) D = DateAdd("h", 1, D) D = DateAdd("n", 1, D) D = DateAdd("s", 1, D) MsgBox "Result = " & CStr(D)
DateDiff Syntax
DateDiff(interval, date1, date2)
Description Returns the difference of 2 dates. The meaning of the result depends on the parameter interval. The result is of type variant. VarType of result = Long. interval : see function DateAdd date1 and date2 : the input dates. Examples
Dim S As String Dim D As Variant D = DateAdd("d", 7, Now) MsgBox Cstr(DateDiff("s", Now, D))
DatePart Syntax
DatePart(interval, date [,FirstDayOfWeek])
Description Returns part (year, month, day,...) of the date. The meaning of the result depends on the parameter interval. The result is of type variant. VarType of result = Integer. interval : indicates the part (eg. month) of the date must be returned. Valid values: see function DateAdd date : the input date. FirstDayOfWeek : by default = vbSunday. Indicates the starting day of the week (day 1). Examples
Dim D As Date D = #2005-08-13# MsgBox "Date = " & CStr(D) & vbCrLf & _ "Day of week = " & Cstr(DatePart("w", D, vbMonday))
DateSerial Syntax
DateSerial(year, month, day)
Description Returns the date based on the sum of year, month, day. Each of the input parameters is of type Integer. month may be larger then 12 and day may be larger then 31. The result is of type variant. VarType of result = Date. Examples
Dim D As Date
Page 35
Day Syntax
Day(DateExpression)
Hour Syntax
Hour(DateExpression)
Minute Syntax
Minute(DateExpression)
Description Returns the minutes (0..59) of the given date. DateExpression must be a valid date and time. Examples
Dim D As Variant D = Minute(#2005-02-28 12:35:20#) ' Returns 35.
Month Syntax
Month(DateExpression)
MonthName Syntax
MonthName(MonthNumber [, Abbreviate])
Description Returns the name of the month (January .. December). If Abbreviate = True, the abbreviated form of the name of the month is returned. Examples
MsgBox MonthName(10) MsgBox MonthName(10, True) ' Returns October ' Returns Oct
Page 36
Now Syntax
Now
Description Returns the current date and time base on the system settings. Examples
Dim D As Variant D = Day(Now) Returns 14:23:40
Second Syntax
Second(DateExpression)
Time Syntax
Time
TimeSerial Syntax
TimeSerial(hours, minutes, seconds)
Description Returns the time based on the sum of hours, minutes, seconds. Each of the input parameters is of type Integer. The result is of type variant. VarType of result = Date. Examples
Dim D As Date D = TimeSerial(23, 30, 30) ' returns 23:30:30
TimeValue Syntax
TimeValue(time)
Description Returns the conversion of a String containing a date to a Variant type. The variant will be of type Date. time = string containing a time. Examples
Dim D As Date D = TimeValue(#12:35:50#) returns 12:35:50
Page 37
Weekday Syntax
Weekday(date [, FirstDayOfWeek])
Description Returns the day of the week of date (1 .. 7). The result is a Variant of type Integer. FirstDayOfWeek = specifies the first day of the week. Default = vbUseSystem. Examples
Dim MyDay As Variant MyDay = Weekday(#2005-10-12#, vbMonday) ' Returns 5
WeekdayName Syntax
WeekdayName(DayNumber [, Abbreviate [, FirstDayOfWeek]])
Description Returns the name of the day (Monday .. Sunday) as a String. If Abbreviate = True, the abbreviated form of the name of the day is returned. If FirstDayOfWeek is omitted, Sunday is the first day of the week. Examples
MsgBox WeekdayName(5, False, vbMonday) MsgBox WeekdayName(5, True, vbMonday) ' Returns Friday ' Returns Fri
Year Syntax
Year(DateExpression)
Various
TypeName Syntax
TypeName(variablename)
Description Returns the name of the type of variablename. The variable must be of type Variant. Examples
Dim V1 As Variant V1 = 1.5 MsgBox TypeName(V1)
VarType Syntax
VarType(variablename)
Description Returns the actual type of variablename. The variable must be of type Variant. Examples
Dim V1 As Variant
Page 38
UBound Syntax
UBound(arrayname[, dimension])
Description The UBound function returns the largest index of the array, or of the dimension of the array. Examples
Dim Names(1 to 10) As String Dim i As Integer For i = LBound(Names) To UBound(Names) Print #1, Names(i) Next i
LBound Syntax
LBound(arrayname[, dimension])
Description The LBound function returns the smallest index of the array, or of the dimension of the array. Examples
See UBound.
Beep Syntax
Beep
Page 39
AppActivate Syntax
AppActivate Title [,wait] or AppActivate ApplicationTaskId [,wait]
Description Sets the focus to the application with the given Title or with the given ApplicationTaskId. The ApplicationTaskId is returned from the Shell function. The optional parameter wait is not used. Examples
Dim AppId As Long AppActivate AppId
Shell Syntax
Shell (ProgramName, [windowStyle])
Description Launches the program specified by ProgramName. If successful, the application's task Id is returned. The applications task Id can be used as a parameter to the AppActivate statement. If the application can not be launched, the runtime error 53 is generated. The parameter windowStyle can have the following values : vbHide, vbNormalFocus, vbMinimizedFocus, vbMaximizedFocus, vbNormalNoFocus, vbMinimizedNoFocus. If this parameter is not given, the default is vbMinimizedFocus. Examples
Dim AppId As Long On Error GoTo ErrorHandler AppId = _ Shell("C:\Program Files\Internet Explorer\IExplore.exe www.pythagoras.net", _ vbNormalFocus) Exit Sub ErrorHandler : MsgBox "Program could not be launched"
Description The Declare statement is used to define references to external procedures in a DLL. Name must be a valid procedure name within the DLL or code library. This function is only available on Windows. Examples
'Declare: Declare Function GetVersion Lib "kernel32"() As Long Dim WindowsVersion As Long
Page 40
WindowsVersion = GetVersion()
End Syntax
End
Description End terminates the VBA program. We recommend not to use the End statement. If used when a Modeless dialog box is active, this statement can cause incorrect termination of a macro. Examples
End
Page 41