Draw a line
Hello
I need to draw a line between 2 coordinates and have found the code I think I need in the help files which is below. However I'm getting the error Type identifier is invalid for the statement Dim mcgoCreated As McGraphObj. I've added the references for IQL.Features and I've imported IQL.Features in the script. I also imported IQL.Display and Addins.Overlays but they didn't help either, any help appreciated.
Sub DrawLine Dim mcgoCreated As McGraphObj With ActiveImage.LineFeatures .AutoDisplay = True 'True by default for McImage.LineFeatures .Reset 'empty it, to be sure '*** for feature 0 create a McGraphObjLine Set mcgoCreated = .AutoDisplayOverlay.Add("McGraphObjLine", mcgtStandardAutoDisplay) mcgoCreated.SetHandle 1, 10, 20 mcgoCreated.SetHandle 2, 30, 20 'The McGraphObj Templates for AutoDisplayOverlay are all non-visible by default mcgoCreated.Style(mcgsVisible) = mcgsVisible 'make it visible End With End Sub
Regards
Dave
0
Best Answer
-
Hi David,There is AnnotationOverlay image property, that should be used for drawing annotaiton objects. The macro below creates a line in annotation overlay:
'Draw line in annotation overlay using low level IQL function Public Sub DrawLineIQL Dim im As McImage=ThisApplication.ActiveImage If im Is Nothing Then Exit Sub' no image Dim ovl As MediaCy.IQL.Display.Overlays.McGraphOverlay=im.AnnotationOverlay Dim line As MediaCy.IQL.Display.Overlays.McGraphObjLine=ovl.Add("McGraphObjLine") line.SetHandle(1,100,100) line.SetHandle(2,200,300) line.NotifyCreationComplete End Sub
I have attached a project (with all references) that implements it. The project also contains RecordedDrawLineMacro macro that shows another way of drawing lines using recorded commands.Regards,Yuri0
Answers
-
Hello Yuri,
Thanks, the low level IQL version is exactly what I want.
Regards
Dave
0
Categories
- All Categories
- 961 Image-Pro v9 and higher
- 9 Image-Pro FAQs
- 18 Image-Pro Download & Install
- 448 Image-Pro General Discussions
- 486 Image-Pro Automation (Macros, Apps, Reports)
- 20 AutoQuant Deconvolution
- 2 AutoQuant Download & Install
- 18 AutoQuant General Discussions
- 195 Image-Pro Plus v7 and lower
- 3 Image-Pro Plus Download & Install
- 106 Image-Pro Plus General Discussions
- 86 Image-Pro Plus Automation with Macros
- 19 Legacy Products
- 16 Image-Pro Premier 3D General Discussions
- 26 Image-Pro Insight General Discussions