CorelDraw X21 SetPosition on a DXF import macro is not compatible with X6-X19 versions.
Working X19 script code that gives the "Run-time error '91' Object variable or with block variable not set" in X21
Version X19 origin is 0,0 bottom left by default without any other settings.
Would like correct X21 SETPOSITION code.
The ActiveDocument.ReferencePoint = cdrBottomLeft does not seem to help.
Thank you in Advance
ActivePage.GuidesLayer.Editable = False ActivePage.GuidesLayer.Editable = True Dim impopt As StructImportOptions Set impopt = CreateStructImportOptions impopt.MaintainLayers = True Dim impflt As ImportFilter ' Set the path for Drill time DXF file Set impflt = ActivePage.Layers("DT").ImportEx("C:\wellsite\d6unit\zDT.DXF", cdrDXF, impopt) With impflt .Projection = 0 ' FilterDXFLib.dxfTop .AutoReduceNodes = False .Scaling = 1 ' FilterDXFLib.dxfEnglish .Finish End With Dim s1 As Shape Set s1 = ActiveShape ' ****************************** Track1 ' Set begining of Drill Time Curve 5" per 100 ft s1.SetPosition 0.241, 55.681 ' Run-time error '91' Object variable or with block variable not set ' ******************************
I think, that ImportEx operation was not successfull. And nothing selected. s1 points to null shape and s1.SetPosition gives run-time error
Similar macro used daily for years that imports a DXF polyline. Works in both Corel x6 & 2019. Gives
the " Run-time error '91' Object variable or with block variable not set" in 2021
Stops at S1.SetPosition 0.241, 55.681 . The DXF will import manually in 2021
An idea on a new syntax would be great.
Sub XLasSP() ' Recorded 3/26/2014 ActivePage.GuidesLayer.Editable = False ActivePage.GuidesLayer.Editable = True Dim impopt As StructImportOptions ' BEGIN OF TOP LINE Set impopt = CreateStructImportOptions impopt.MaintainLayers = True Dim impflt As ImportFilter Set impflt = ActivePage.GuidesLayer.ImportEx("C:\wellsite\d6unit\lasSP.DXF", cdrDXF, impopt) With impflt .Projection = 0 ' FilterDXFLib.dxfTop .AutoReduceNodes = False .Scaling = 1 ' FilterDXFLib.dxfEnglish .Finish End With Dim s1 As Shape Set s1 = ActiveShape ' x left edge report 0.241 ' y begin line @ 55.681
' ***************************** Track1 ' Set begining of SP curve s1.SetPosition 0.241, 55.681 ' ****************************** Dim grp1 As ShapeRange Set grp1 = s1.UngroupExgrp1.SetOutlineProperties 0.014, OutlineStyles(8), CreateCMYKColor(100, 0, 100, 0), LineCaps:=cdrOutlineSquareLineCaps, DashDotLength:=0# ' END OF TOP LINE End Sub