Converter.Iterate
Moderators: SDS, support, admin
Converter.Iterate
I'm using
To iterate over my entities...
in "ReadCADEntitiesParamsToPDF" i'm using
to check if the layer is visible or not.
Before doing this i want to be able to hide some layer/blocks and recalculate new extensions without hidden objects...
But when i get here
Dim layer As CADLayer = CADConst.EntLayer(entity, _cadParams.insert)
My layer that should be hidden by "HideLayers" procedure is still visible.
What is wrong ?
PS: also doing
doesn't affect to entities in iteration...
Code: Select all
_cadParams = New CADIterate
_cadParams.matrix = New CADMatrix
_cadParams.matrix.data(0, 0) = 1
_cadParams.matrix.data(1, 1) = 1
_cadParams.matrix.data(2, 2) = 1
_cadImage.Converter.AutoInsert = True
_cadImage.Converter.Iterate(New CADEntityProc(AddressOf Me.ReadCADEntitiesParamsToPDF), Nothing, _cadParams)
in "ReadCADEntitiesParamsToPDF" i'm using
Code: Select all
CADConst.DoScale2D((_cadParams))
Dim layer As CADLayer = CADConst.EntLayer(entity, _cadParams.insert)
If Not IsNothing(layer) AndAlso Not layer.Visible Then
Exit Sub
End If
Before doing this i want to be able to hide some layer/blocks and recalculate new extensions without hidden objects...
But when i get here
Dim layer As CADLayer = CADConst.EntLayer(entity, _cadParams.insert)
My layer that should be hidden by "HideLayers" procedure is still visible.
What is wrong ?

PS: also doing
Code: Select all
_cadImage.DrawMode = CADDrawMode.Black
_cadImage.BackgroundColor = Color.White
Code: Select all
Public Sub HideLayers(ByVal LayerList As String)
If LayerList <> "" Then
Dim Elenco() As String = LayerList.Split(";"c)
For Each Nome As String In Elenco
If Nome.Trim <> "" Then
Dim Lay As CADLayer = _cadImage.Converter.LayerByName(Nome)
Lay.Visibility = False
Lay.Visible = False
Lay.Loaded(_cadImage.Converter)
_cadImage.Converter.Loads(Lay)
End If
Next
End If
_cadImage.GetExtents()
End Sub
Re: Converter.Iterate
Hello.
Unfortunately the CADConverter.LayerByName method works correctly if only layer doesn't exists. Please modify your HideLayers method to access layers using index in _cadImage.Converter.Layers collection to get correct layer visibility settings.
Also the codeworks. The first code string set the black/white entities drawing mode. It will affect any entity that have some color, different from black or white. However if you want white background then please set BackColor property of the PictureBox object (like in White_Click method in demo app).
Alexander.
Unfortunately the CADConverter.LayerByName method works correctly if only layer doesn't exists. Please modify your HideLayers method to access layers using index in _cadImage.Converter.Layers collection to get correct layer visibility settings.
Also the code
Code: Select all
_cadImage.DrawMode = CADDrawMode.Black
_cadImage.BackgroundColor = Color.White
Alexander.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support
Chat support on Skype: cadsofttools.support
Re: Converter.Iterate
Ok i've changed my proc in
But i'm missing some info.
I suppose that _cadImage.GetExtents() could get new drawing extensions, for entities that are still visible...
So if I hide some layers/ blocks is there a way/method to get new "visible" extensions ?
Code: Select all
Public Sub HideLayers(ByVal LayerList As String)
If LayerList <> "" Then
Dim Elenco() As String = LayerList.Split(";"c)
For Each Nome As String In Elenco
If Nome.Trim <> "" Then
For Il As Integer = 0 To _cadImage.Converter.Layers.Count - 1
If _cadImage.Converter.Layers(Il).EntName.ToUpper = Nome.ToUpper Then
_cadImage.Converter.Layers(Il).Visibility = False
CType(_cadImage.Converter.Layers(Il), CADLayer).Visible = False
_cadImage.Converter.Layers(Il).Loaded(_cadImage.Converter)
_cadImage.Converter.Loads(_cadImage.Converter.Layers(Il))
End If
Next
End If
Next
End If
_cadImage.GetExtents()
End Sub
I suppose that _cadImage.GetExtents() could get new drawing extensions, for entities that are still visible...
So if I hide some layers/ blocks is there a way/method to get new "visible" extensions ?
Re: Converter.Iterate
Hello.
CADImage.GetExtents() calculates extents using all entities regardless of each entity visibility. So, making some layer invisible do not make different. However you can create CADLayout object, add a set of required entities to it and set this layout as current (CADImage.CurrentLayout). The extents calculated for the current layout.
Alexander.
CADImage.GetExtents() calculates extents using all entities regardless of each entity visibility. So, making some layer invisible do not make different. However you can create CADLayout object, add a set of required entities to it and set this layout as current (CADImage.CurrentLayout). The extents calculated for the current layout.
Alexander.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support
Chat support on Skype: cadsofttools.support
Re: Converter.Iterate
... but i get the same extensions also with some layer hidden...
and the code to hide is ...
and the code to hide is ...
Code: Select all
_cadImage.Converter.Layers(Il).Visibility = False
CType(_cadImage.Converter.Layers(Il), CADLayer).Visible = False
_cadImage.Converter.Layers(Il).Loaded(_cadImage.Converter)
_cadImage.Converter.Loads(_cadImage.Converter.Layers(Il))
Re: Converter.Iterate
Hello.
Visibility of any layer only affects visibility of entities belonging to this layer. Please read my previous post. Create CADLayout object, add entities to this layout then set it as current and you will receive extents of the set of the entities that included to this layout by CADImage.GetExtents() method.
Alexander.
Visibility of any layer only affects visibility of entities belonging to this layer. Please read my previous post. Create CADLayout object, add entities to this layout then set it as current and you will receive extents of the set of the entities that included to this layout by CADImage.GetExtents() method.
Alexander.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support
Chat support on Skype: cadsofttools.support