Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Variant type object arrays
#3
Code so far :
import pyautocad
import os
import comtypes
import time

from pyautocad import *
ACAD = Autocad(create_if_not_exists=True)
try:
    ACAD.ActiveDocument.SelectionSets.Item("SS2").Delete()
except:
    pass 
SS2obj = ACAD.ActiveDocument.SelectionSets.Add("SS2")
FilterType = "0" #it should be array of integers
FilterData = "Line" # this should be array of variants(strings)
SS2obj.Select("5","","", FilterType, FilterData) #[url=https://knowledge.autodesk.com/search-result/caas/CloudHelp/cloudhelp/2016/ENU/AutoCAD-ActiveX/files/GUID-A809CD71-4655-44E2-B674-1FE200B9FE30-htm.html]Here[/url]link whats needed in autocad, cant link directly, go to selectionSet, Select(under Methods) #Also, noticed i cannot make empty commas. ",,," so i guess ,"","", should work ?
SS2obj.Highlight("1")
This how it looks in autohotkey wihtout comments:
SS2obj := ACAD.ActiveDocument.SelectionSets.Add("SS2")
FilterType := VarArrayCreate(2, "0", "8")		
FilterData := VarArrayCreate(0xC, "Line", "LayerName") 
SS2obj.Select("5",,, FilterType, FilterData)

VarArrayCreate(Type=0xC, Values*)
{
	arr := ComObjArray(Type, Values.MaxIndex())
	for i, v in Values{ 
		arr[i-1] := v
		; MsgBox % v "," i
	}
	return arr
}
This is the error Visual Studio shows, if this helps :
_ctypes.COMError: (-2147352567, 'Exception occurred.', ('Invalid argument FilterType in Select', 'AutoCAD', 'C:\Program Files\Autodesk\AutoCAD 2018\HELP\OLE_ERR.CHM', -2145320939, None))
Also, quick note. there is in pyautocad some arrays with types in the link you gave above, but there are no "variant" array, and integer of 32 bit is burried in library, for me as newb, a bit hard to "extract" into simple function.
This is the array given in pyautocad of integers
pyautocad.types.aInt(*seq)
Returns array.array of ints (ā€˜lā€™ code) for passing to AutoCAD
Reply


Messages In This Thread
Variant type object arrays - by anbra - Jul-28-2018, 05:37 PM
RE: Variant type object arrays - by buran - Jul-28-2018, 06:49 PM
RE: Variant type object arrays - by anbra - Jul-28-2018, 07:25 PM
RE: Variant type object arrays - by anbra - Jul-29-2018, 09:25 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  declaring object parameters with type JonWayn 2 912 Dec-13-2022, 07:46 PM
Last Post: JonWayn
Star Type Error: 'in' object is not callable nman52 3 3,421 May-01-2021, 11:03 PM
Last Post: nman52
  TypeError: 'type' object is not subscriptable Stef 1 4,544 Aug-28-2020, 03:01 PM
Last Post: Gribouillis
  Type coercion with Numpy arrays Mark17 2 2,535 Jul-24-2020, 02:04 AM
Last Post: scidam
  isinstance() always return true for object type check Yoki91 2 2,581 Jul-22-2020, 06:52 PM
Last Post: Yoki91
  AttributeError: type object 'FunctionNode' has no attribute '_TestValidateFuncLabel__ binhduonggttn 0 2,256 Feb-19-2020, 11:29 AM
Last Post: binhduonggttn
  Type hinting - return type based on parameter micseydel 2 2,513 Jan-14-2020, 01:20 AM
Last Post: micseydel
  Object of type set is not JSON serializable enigma619 5 12,278 Dec-19-2019, 03:30 PM
Last Post: enigma619
  type of object as a string Skaperen 1 2,305 Dec-02-2019, 08:01 AM
Last Post: midarq
  Object of type Scoreboard is not JSON serializable lsepolis123 9 9,478 Aug-13-2019, 11:22 AM
Last Post: lsepolis123

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020