Routines in CBL involving selection sets
sub OSLCount()
msg$="OSL Count="+str$(CdiOslCount(0&))+" objects"
msgbox msg$,0,"Objects Selected"
end sub
This code will count the number of highlighted symbols in the Cadvance OSL:
sub OSLCountSymbols()
Dim object1 As CDI_OSL_OBJECT
TotalSymbols&=0
For osl_item& = 1 To CdiOslCount(0&)
i_ret% = CdiOslItem(0&, osl_item& - 1, object1)
i_ret% = CdiObjType (object1.sid, obj_type%, layer%)
select case obj_type%
case CDI_SYMBOL
TotalSymbols&=TotalSymbols&+1
case else
end select
Next osl_item&
msg$="Total selected: "+str$(TotalSymbols&)
msgbox msg$,0,"Symbol count"
end sub
This code will copy Cadvance OSL objects to a specified layer:
sub CopyToLayer()
dim object1 as CDI_OSL_OBJECT
if CdiOslCount(0&)=0 then
exit sub
end if
layer%=CdiGetActLayer()
i_ret=CdiGetShort("copy to layer", 1, 255, layer%)
if i_ret=CDI_ERROR then
i_ret=CdiFreeLocalOsl(l_osl&)
exit sub
end if
for osl_item&=1 to CdiOslCount(0&)
i_ret=CdiOslItem( 0&, osl_item&-1, object1)
select case CdiGetProgMode
case CDI_2D_MODE
i_ret=CdiEditDup(object1.sid, 0, 0, layer%, CDI_OBJECT_COLOR)
case CDI_3D_MODE
i_ret=CdiEdit3DDup(object1.sid, 0, 0, 0, layer%, CDI_OBJECT_COLOR)
end select
next osl_item&
end sub
|
|
Visual Engineering POB 1247 New York, NY 10025-1247 Phone: (212) 864-1998 |