Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

WBLOCK Syntax is Different from One Computer to Another Computer

3 REPLIES 3
Reply
Message 1 of 4
JC_BL
368 Views, 3 Replies

WBLOCK Syntax is Different from One Computer to Another Computer

I find that WBLOCK syntax is different from one computer to another computer.  I would like to know how I can get them to use the syntax; then I don't need to write two different versions of the same program.

 

Let say I have a selection-set, and I have already used (sssetfirst) to highlight all the objects in the selection-set.  I find that in my computer, I need to use this WBLOCK syntax:

 

  • (command "-wblock" "C:\\Temp\\OutObj.dwg" "0,0,0")

 

I cannot use either one of the following syntax in my computer:

 

  • (command "-wblock" "C:\\Temp\\OutObj.dwg" "0,0,0" (ssget))
  • (command "-wblock" "C:\\Temp\\OutObj.dwg" "0,0,0" (ssget) "")

 

On the other hand, in computer-2, I need to use this WBLOCK syntax:

 

  • (command "-wblock" "C:\\Temp\\OutObj.dwg" "0,0,0" (ssget) "")

 

I cannot use either one of the following syntax in computer-2:

 

  • (command "-wblock" "C:\\Temp\\OutObj.dwg" "0,0,0" (ssget))
  • (command "-wblock" "C:\\Temp\\OutObj.dwg" "0,0,0")

 

Other than the fact that I am running the program in two different computers, the rest is the same.  They both use the same version of AutoCAD (2012), and they both are tested using the same copy of drawing.  Therefore, I don't understand why there is difference in syntax.

 

Please help.  Thanks in advance.

 

Jay Chan

Tags (1)
3 REPLIES 3
Message 2 of 4
hmsilva
in reply to: JC_BL

Make sure that PICKFIRST is set to 1 in both computers.

Henrique

EESignature

Message 3 of 4
JC_BL
in reply to: JC_BL

I finally figured out what went wrong with -WBLOCK command.  My computer has QAFLAGS set to zero (by default).  The computer-2 has QAFLAGS somehow set as 1.  For some reason, WBLOCK doesn't like QAFLAGS to be 1, and it seems to de-select everything before it starts doing anything.  That may be the reason why WBLOCK in computer-2 was acting like PickFirst is 0.  I ask the program to change QAFLAGS to 0 before calling WBLOCk and then reset it back to the original value.  This works.  And now I change the program from using vla-wblock back to -WBLOCK.

 

Another related issue is that EXPLODE command wants the QAFLAGS to be opposite from what WBLOCK wants.  The EXPLODE wants QAFLAGS to be 1.  Otherwise, it will de-select everything before it starts doing anything.  I have no idea why these two commands seem to want the QAFLAGS to be completely different.  But I just have to "deal" with them.

 

Hope this helps someone.

 

Jay Chan

Message 4 of 4
JC_BL
in reply to: JC_BL

Seem like my previous message about replacing the use of WBLOCK with vla-wblock didn't go through.  I repost here:

 

I find that I can get around this problem by using vla-wblock instead of -WBLOCK, like this:

 

(defun JayTest
   ( /
   ssPL
   oActiveDoc
   )
   ;Load VL library if it has not been loaded already.
   (vl-load-com)

   ;Create a selecction-set that has polylines that are on
   ;"_Annotations" layer and they are in blue or magenta.
   (setq ssPL
      (ssget "_X"
         (list
            '(0  . "*POLYLINE"   )  ;Group  0: Entity type
            '(8  . "_Annotations")  ;Group  8: Layer name
            '(-4 . "<or")           ;Group -4: Or-condition
               (cons 62 5)          ;Group 62: Color (blue)
               (cons 62 6)          ;Group 62: Color (magenta)
            '(-4 . "or>")           ;Group -4: Or-condition
         )
      )
   )

   ;Select those polylines and output them to a polyline file.
   (if ssPL
      (progn
         (setq oActiveDoc (vla-get-activedocument (vlax-get-acad-object)))
         (setq ssPL (vla-get-activeselectionset oActiveDoc))
         (vla-wblock oActiveDoc "C:\\Temp\\Polyline.dwg" ssPL)

         (setq ssPL nil)
      )
   )

   (princ)
) ;defun

(defun Compile_OK ( / )
   (setq nDummy 1)
) ;defun

 

I decide not to use this "workaround" because I can fix this problem by setting QAFLAGS to zero.

 

Jay Chan

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost