ssobj.SelectOnScreen(groupCode, dataCode)在net中应用
用.NET开发托管程序集已经是越来越被大家接受,但单纯从开发效率来讲,vba、vb60开发还是有一定优势,从代码对比上可以感觉到。尤其老程序完全由net改写工作量将很大。net接受通过COM方式使用ActiveX技术,使改写变得容易。在改写中遇到一个问题:ssobj.SelectOnScreen(groupCode, dataCode)即建立带过滤条件的屏幕选择集,在vba下没有问题,可在net下没好用。烦请有过如此应用的高手给予指点。谢谢! short[] groupCode= new short[] { 0 };object[] dataCode = new object[] { "*" };
改后面大括弧里面的东东,应该可以吧?
楼上没有理解我的意思,我是说使用vb.net中的引用com技术,针对原来使用vba的程序进行修改,带过滤条件的选择集不成功,不知道原因,有成功的请指教。 Imports Autodesk.AutoCAD.RuntimeImports Autodesk.AutoCAD.ApplicationServicesImports Autodesk.AutoCAD.DatabaseServicesImports Autodesk.AutoCAD.EditorInput <CommandMethod("FilterBlueCircleOnLayer0")> _Public Sub FilterBlueCircleOnLayer0() '' Get the current document editor Dim acDocEd As Editor = Application.DocumentManager.MdiActiveDocument.Editor'' Create a TypedValue array to define the filter criteria Dim acTypValAr(2) As TypedValue acTypValAr.SetValue(New TypedValue(DxfCode.Color, 5), 0) acTypValAr.SetValue(New TypedValue(DxfCode.Start, "CIRCLE"), 1) acTypValAr.SetValue(New TypedValue(DxfCode.LayerName, "0"), 2)'' Assign the filter criteria to a SelectionFilter object Dim acSelFtr As SelectionFilter = New SelectionFilter(acTypValAr)'' Request for objects to be selected in the drawing area Dim acSSPrompt As PromptSelectionResult acSSPrompt = acDocEd.GetSelection(acSelFtr)'' If the prompt status is OK, objects were selected If acSSPrompt.Status = PromptStatus.OK Then Dim acSSet As SelectionSet = acSSPrompt.ValueApplication.ShowAlertDialog("Number of objects selected: " & _ acSSet.Count.ToString()) Else Application.ShowAlertDialog("Number of objects selected: 0") End IfEnd Sub 好好看帮助,自己去调试吧,开发人员帮助 明总,这个vb.net代码怎么不能识别? 非常感谢,调试成功了。 ljq 发表于 2013-7-4 23:08
非常感谢,调试成功了。
请教,这个问题怎么解决的?我摸索了好久,就差放弃com改用.net语法重新改写了 已找到答案,integer 改short非常好用!
页:
[1]