How to use .Net to cutting double line automatic?

How to use .Net to cutting double line automatic?

Anonymous
Not applicable
977 Views
5 Replies
Message 1 of 6

How to use .Net to cutting double line automatic?

Anonymous
Not applicable

hi,everyone. i have some  trouble in .NET,the drawing blow ,the left   is a double line ,the right has two double line,one is at the end ,the other is at the middle,how can they cut  automatic like this when drawing  these double lines?thanks
QQ截图未命名.jpg

0 Likes
Accepted solutions (1)
978 Views
5 Replies
Replies (5)
Message 2 of 6

Anonymous
Not applicable

do you mean "multiline"...

 

jvj

0 Likes
Message 3 of 6

Anonymous
Not applicable

yes,multiline

0 Likes
Message 4 of 6

Hallex
Advisor
Advisor
Accepted solution

You could play with this code

    ''============================cut mline=====================
    <DllImport("acad.exe", BestFitMapping:=True, CallingConvention:=CallingConvention.Cdecl, CharSet:=CharSet.Auto)> _
    Private Shared Function acedCmd(ByVal vlist_in As System.IntPtr) As Integer
    End Function
    <CommandMethod("MCUT")> _
    Public Shared Sub CutMline()
        Dim db As Database = HostApplicationServices.WorkingDatabase

        Dim doc As Document = acApp.DocumentManager.MdiActiveDocument

        Dim ed As Editor = doc.Editor

        Dim tr As Transaction = db.TransactionManager.StartTransaction()

        Using tr

            Try

                Dim peo As New PromptEntityOptions(vbLf & "Select first mline:")

                peo.SetRejectMessage(vbLf & "Select mline only")

                peo.AddAllowedClass(GetType(Mline), True)

                Dim per As PromptEntityResult = ed.GetEntity(peo)

                If per.Status <> PromptStatus.OK Then

                    Return

                End If

                Dim fid As ObjectId = per.ObjectId

                peo.Message = vbLf & "Select second mline:"

                per = ed.GetEntity(peo)

                If per.Status <> PromptStatus.OK Then

                    Return

                End If

                Dim sid As ObjectId = per.ObjectId

                Dim ids As ObjectId() = New ObjectId(1) {}

                ids(0) = fid

                ids(1) = sid

                Dim obj1 As DBObject = tr.GetObject(fid, OpenMode.ForWrite)

                Dim obj2 As DBObject = tr.GetObject(sid, OpenMode.ForWrite)

                'acApp.SetSystemVariable("FILLETRAD", rad)

                acApp.SetSystemVariable("CMDECHO", 0)

                Dim buf As New ResultBuffer()

                buf.Add(New TypedValue(5005, "_-MLEDIT"))

                buf.Add(New TypedValue(5005, "CT")) ''<--change editing option here [CC/OC/MC/CT/OT/MT/CJ/AV/DV/CS/CA/WA]

                buf.Add(New TypedValue(5006, fid))

                buf.Add(New TypedValue(5006, sid))

                buf.Add(New TypedValue(5005, ""))

                acedCmd(buf.UnmanagedObject)

                buf.Dispose()

                acApp.SetSystemVariable("CMDECHO", 1)

                tr.Commit()

            Catch ex As Autodesk.AutoCAD.Runtime.Exception

                ed.WriteMessage(ex.Message + vbLf + ex.StackTrace)

            End Try

        End Using
    End Sub

 

 

~'J'~

_____________________________________
C6309D9E0751D165D0934D0621DFF27919
0 Likes
Message 5 of 6

Anonymous
Not applicable

thanks ,hallex.

i used the code you post,but it'does'nt work like i think.see the below pic.

TM截图未命名.jpg

0 Likes
Message 6 of 6

Hallex
Advisor
Advisor

Change editing option jn what you need: CC/OC/MC/CT/OT/MT/CJ/AV/DV/CS/CA/WA

_____________________________________
C6309D9E0751D165D0934D0621DFF27919
0 Likes