Block is not straight when inserted via LISP??

Block is not straight when inserted via LISP??

joe_kohli
Advocate Advocate
545 Views
9 Replies
Message 1 of 10

Block is not straight when inserted via LISP??

joe_kohli
Advocate
Advocate

So, I have a LISP command that automatically creates a new layer and allows me to draw a polyline. Once you close the polyline it converts it to a rev cloud and insert hatch within the boundaries. It also inserts a block from a library in my workstation as the last step. It has worked great until a few weeks ago. Now all the sudden, when it inserts the block, it angles it. Please watch the demonstration video I attached. I have a few of these types of LISP's where it will insert the block for you as the last step. EVERY one of them default to just a fraction of a degree off from exactly 0°. Why?

 

;THIS SECTION OF CODE IS FOR TAR ONLY CLOUDS AND INFO


(defun c:NOTINSERVICE (/ la)		; = NOT IN SERVICE CLOUD  
  (setq la (getvar 'clayer))           ; Store the current layer
  (command "_.layer" "_make" "NOT IN SERVICE" "Color" 252 "" "")  ; Create or set the layer "NOT IN SERVICE"
  

  
  (command-s "_.pline")  ; Start a polyline command
  (command "_.revcloud" "a" "0.1875" "0.1875" "o" "_last" "no"
           "_.pedit" "last" "width" "0.00" ""
           "_.-hatch" "_advanced" "_island" "_no" "" "" "_properties" "ANSI37" 1.0 0 "_select" "_last" "" ""
          )  ; Complete the revcloud, pedit, and hatch commands
  
  ;; Automatically insert the DAILY MAINTENANCE REV TRIANGLE block from the specified path
  (command "_.insert"
           "C:\\Users\\xxxxx\\OneDrive\\folder\\AutoCAD\\pidblks_dyn\\NIS_BOX_DYN.dwg"
           "\\" "" "1.0" "1.0" "0.0"
   )

  )

0 Likes
Accepted solutions (1)
546 Views
9 Replies
Replies (9)
Message 2 of 10

ВeekeeCZ
Consultant
Consultant

Would you post a dwg with that block?

0 Likes
Message 3 of 10

paullimapa
Mentor
Mentor

If you just copied and paste the insert part of the code to the command line in a new dwg does the same problem occur?

(command "_.insert"      "C:\\Users\\xxxxx\\OneDrive\\folder\\AutoCAD\\pidblks_dyn\\NIS_BOX_DYN.dwg" "\\" "" "1.0" "1.0" "0.0"
)

Also if you open this dwg, is it lined up orthogonally?

Any difference if you turned off all running object snaps?

 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 4 of 10

joe_kohli
Advocate
Advocate

Sure! Here is the block that I am pulling from in my library.

0 Likes
Message 5 of 10

ВeekeeCZ
Consultant
Consultant
Accepted solution

Replace this

"\\" "" "1.0" "1.0" "0.0"

with

"_s" 1 "_r" 0 "\\"

 

better also add -s

command-s "_.insert"

 

 

 

See the command-line how inputs don't match...

 

Command: (command "_.insert" "NIS_BOX_DYN.dwg" "\\" "" "1.0" "1.0" "0.0")
_.insert Enter block name or [?] : NIS_BOX_DYN.dwg
Units: Inches   Conversion:    1.0000
Specify insertion point or [Basepoint/Scale/X/Y/Z/Rotate/Explode/REpeat]: "\\" user-input-click
Enter X scale factor, specify opposite corner, or [Corner/XYZ] <1>: "" as <enter> Enter Y scale factor : 1.0
Specify rotation angle <0>: 1.0
Command: 0.0 Unknown command "0".  Press F1 for help.

 

0 Likes
Message 6 of 10

joe_kohli
Advocate
Advocate

That fixed it. I understand now what you are saying.

0 Likes
Message 7 of 10

paullimapa
Mentor
Mentor

It has worked great until a few weeks ago.”

Now the big question is what happened a few weeks ago that changed the code to make the insert part not work properly?


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 8 of 10

Moshe-A
Mentor
Mentor

@paullimapa HI,

 


@paullimapa wrote:

It has worked great until a few weeks ago.”

Now the big question is what happened a few weeks ago that changed the code to make the insert part not work properly?


Sure the extra double quotes after "\\" 😀 

 

(command "_.insert" "NIS_BOX_DYN.dwg" "\\" "" "1.0" "1.0" "0.0")

 

0 Likes
Message 9 of 10

paullimapa
Mentor
Mentor

Yep someone (and I won’t mention any names) for some reason thought a return is required after the pause…


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 10 of 10

Moshe-A
Mentor
Mentor

@paullimapa wrote:

Yep someone (and I won’t mention any names) for some reason thought a return is required after the pause…


😂🤣😂🤣

0 Likes