Jump to content

Recommended Posts

Posted

Hi

i wrote some code but it wont work as it should. The program starts in the vb file call a lisp file run function but it first should create a hatch and then go forward how to wait for the lisp file to run and then do the rest of the code i have no idea :)

The VB.NET

    <CommandMethod("str")> _
   Public Sub str()
       kreskowanie()

       Dim lCmd As Editor = Application.DocumentManager.MdiActiveDocument.Editor
       Dim acBaza As Database = lCmd.Document.Database
       Dim typeValue() As TypedValue = {New TypedValue(0, "hatch")}
       Dim selFilter As SelectionFilter = New SelectionFilter(typeValue)
       Dim selResult As PromptSelectionResult = lCmd.SelectAll(selFilter)

       Dim ssHatch As SelectionSet = selResult.Value
       Dim tabId_HatchObjId() As ObjectId
   End Sub

   Public Sub kreskowanie()
       Dim lCmd As Editor = Application.DocumentManager.MdiActiveDocument.Editor
       Dim acBaza As Database = lCmd.Document.Database
       Dim myDWG As ApplicationServices.Document = ApplicationServices.Application.DocumentManager.MdiActiveDocument

       Using trn As Transaction = acBaza.TransactionManager.StartTransaction

           Dim cmdString As String
           cmdString = ("(load ""C:/kreskowanie.LSP"" ""The load failed"")" & Chr(13))
           myDWG.SendStringToExecute(cmdString, True, False, False)

           cmdString = ("(h_kreska)" & Chr(13))
           myDWG.SendStringToExecute(cmdString, True, False, False)

           trn.Commit()
       End Using

   End Sub

The LISP file

(defun H_KRESKA ()
 (setq lp (getvar "clayer"))
 (prompt "\nWybierz wnetrze: ")
 (bhatch)
 (while (eq 1 (logand 1 (getvar "cmdactive")))
   (command pause))
 (if (tblsearch "layer" "A-HATCH")
   (command "_.chprop" "_last" "" "_layer" "A-HATCH" ""))
 (if lp
   (setvar "clayer" lp))
 (princ)
)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...