Drawing with linetypes
Moderators: SDS, support, admin
Drawing with linetypes
Hello
Please could you explain a bit about drawing polylines with different linetypes? I'm using CadImport.NET and VB
Thanks!!
Please could you explain a bit about drawing polylines with different linetypes? I'm using CadImport.NET and VB
Thanks!!
Hello Zebiya,
The following code adds new line type "ISO dash", if it doesn't exists and sets it to all CADLines in the loaded file:
Sergey.
Please post questions to the forum or write to support@cadsofttools.com
The following code adds new line type "ISO dash", if it doesn't exists and sets it to all CADLines in the loaded file:
Code: Select all
<font color="blue">Private Sub</font id="blue"> btnAddLType_Click(<font color="blue">ByVal</font id="blue"> sender <font color="blue">As</font id="blue"> System.Object, <font color="blue">ByVal</font id="blue"> e <font color="blue">As</font id="blue"> System.EventArgs) <font color="blue">Handles</font id="blue"> btnAddLType.Click
<font color="blue">If</font id="blue"> (Me.FCADImage <font color="blue">Is Nothing</font id="blue">) <font color="blue">Then Return
Me</font id="blue">.FCADImage.UseBufMetafile = <font color="blue">False</font id="blue">
<font color="blue">Me</font id="blue">.cadPictBox.Invalidate()
<font color="blue">Dim</font id="blue"> lType <font color="blue">As</font id="blue"> CADLineType
lType = <font color="blue">Me</font id="blue">.FCADImage.Converter.LTypeByName("ISO dash")
<font color="blue">If</font id="blue"> (lType <font color="blue">Is Nothing</font id="blue">) <font color="blue">Then</font id="blue">
lType = <font color="blue">New</font id="blue"> CADLineType
lType.Name = "ISO dash"
lType.Lines.Ticks.Add(1.2)
lType.Lines.Ticks.Add(-0.3)
<font color="blue">Me</font id="blue">.FCADImage.Converter.LinesByName("ISO dash")
<font color="blue">Me</font id="blue">.FCADImage.Converter.GetSection(CADImport.ConvSection.LTypes).AddEntity(lType)
<font color="blue">End If
Dim</font id="blue"> I <font color="blue">As</font id="blue"> Integer
<font color="blue">Dim</font id="blue"> entLine <font color="blue">As</font id="blue"> CADLine
<font color="blue">For</font id="blue"> I = 0 <font color="blue">To</font id="blue"> <font color="blue">Me</font id="blue">.FCADImage.Converter.Entities.Count - 1
If (TypeOf <font color="blue">Me</font id="blue">.FCADImage.Converter.Entities(I) <font color="blue">Is</font id="blue"> CADLine) <font color="blue">Then</font id="blue">
entLine = <font color="blue">Me</font id="blue">.FCADImage.Converter.Entities(I)
entLine.SetLType(lType)
entLine.LineWeight = 1.4
<font color="blue">Me</font id="blue">.FCADImage.Converter.Loads(entLine)
<font color="blue">End If
Next </font id="blue">I
<font color="blue">Me</font id="blue">.cadPictBox.Invalidate()
<font color="blue">End Sub</font id="blue">
Please post questions to the forum or write to support@cadsofttools.com
Thank you, Sergey, I realise it is a good and simple example but I was looking for an "explanation".
For instance,
Ñ—what can I do with <i>LType.Pen.DashStyle</i>?
Ñ—Can I make more "complex" linetypes?
Ñ—How?
Ñ—Which are the limits?
Ñ—What does exactely mean LineTypeScale?
Ñ—What are Ticks?
I am sure you will make those things clear for me. I do not need very deep teaching, but just some quick clues to manage linetypes
Thank you very much
For instance,
Ñ—what can I do with <i>LType.Pen.DashStyle</i>?
Ñ—Can I make more "complex" linetypes?
Ñ—How?
Ñ—Which are the limits?
Ñ—What does exactely mean LineTypeScale?
Ñ—What are Ticks?
I am sure you will make those things clear for me. I do not need very deep teaching, but just some quick clues to manage linetypes
Thank you very much
Hello Zebiya!
<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">Ñ—what can I do with LType.Pen.DashStyle?<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
This line does not allows to do anything. <b>CAD Import .NET</b> does not use standard system dash styles.
<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">Ñ—Can I make more "complex" linetypes?
Ñ—How?
Ñ—Which are the limits?<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
Please use the following example:
Number of ticks is unlimited.
<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">Ñ—What are Ticks?<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
<b>Ticks</b> define length of dashes and dots and empty spaces between them.
Positive value defines a dash(or dot - dependently on its length).
Negative value defines empty space between dashes (dots).
<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">Ñ—What does exactely mean LineTypeScale? <hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
<b>LineTypeScale</b> defines a value which is used for multiplying length of dashes and dots and empty spaces between them.
Currently changing CADLineType.LineTypeScale gives no result. It will be corrected in future versions of the library. Until that we recommend to set this value for entities directly:
Sergey
Please post questions to the forum or write to support@cadsofttools.com
<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">Ñ—what can I do with LType.Pen.DashStyle?<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
This line does not allows to do anything. <b>CAD Import .NET</b> does not use standard system dash styles.
<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">Ñ—Can I make more "complex" linetypes?
Ñ—How?
Ñ—Which are the limits?<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
Please use the following example:
Code: Select all
<font color="blue">Dim</font id="blue"> lType <font color="blue">As</font id="blue"> CADLineType
lType = <font color="blue">Me</font id="blue">.FCADImage.Converter.LTypeByName("New LineType")
<font color="blue">If</font id="blue"> (lType <font color="blue">Is Nothing</font id="blue">) <font color="blue">Then</font id="blue">
lType = <font color="blue">New</font id="blue"> CADLineType
lType.Name = "New LineType"
lType.Lines.Ticks.Add(5.0)
lType.Lines.Ticks.Add(-0.5)
lType.Lines.Ticks.Add(0.1)
lType.Lines.Ticks.Add(-0.5)
lType.Lines.Ticks.Add(0.1)
lType.Lines.Ticks.Add(-0.5)
lType.Lines.Ticks.Add(0.1)
lType.Lines.Ticks.Add(-0.5)
<font color="blue">Me</font id="blue">.FCADImage.Converter.GetSection(CADImport.ConvSection.LTypes).AddEntity(lType)
<font color="blue">End If</font id="blue">
<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">Ñ—What are Ticks?<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
<b>Ticks</b> define length of dashes and dots and empty spaces between them.
Positive value defines a dash(or dot - dependently on its length).
Negative value defines empty space between dashes (dots).
<blockquote id="quote"><font size="2" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">Ñ—What does exactely mean LineTypeScale? <hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
<b>LineTypeScale</b> defines a value which is used for multiplying length of dashes and dots and empty spaces between them.
Currently changing CADLineType.LineTypeScale gives no result. It will be corrected in future versions of the library. Until that we recommend to set this value for entities directly:
Code: Select all
<font color="blue">Dim</font id="blue"> I <font color="blue">As Integer
Dim</font id="blue"> entLine <font color="blue">As</font id="blue"> CADLine
<font color="blue">For</font id="blue"> I = 0 <font color="blue">To Me</font id="blue">.FCADImage.Converter.Entities.Count - 1
<font color="blue">If</font id="blue"> (<font color="blue">TypeOf Me</font id="blue">.FCADImage.Converter.Entities(I) <font color="blue">Is</font id="blue"> CADLine) <font color="blue">Then</font id="blue">
entLine = <font color="blue">Me</font id="blue">.FCADImage.Converter.Entities(I)
entLine.SetLType(lType)
entLine.LineWeight = 0.6
entLine.LineTypeScale = 20
<font color="blue">Me</font id="blue">.FCADImage.Converter.Loads(entLine)
<font color="blue">End If
Next I</font id="blue">
Please post questions to the forum or write to support@cadsofttools.com