One of my prompts isnt appearing

One of my prompts isnt appearing

christian_paulsen98V29
Enthusiast Enthusiast
725 Views
11 Replies
Message 1 of 12

One of my prompts isnt appearing

christian_paulsen98V29
Enthusiast
Enthusiast

Made a pretty cool little command this morning that creates 4 views of an object in model space.

Everything is working fine but the first prompt that says "\nQUICK VIEWS - Select objects to block .." isnt showing up. Any reason why?


Im also open to any suggestions on how i couldve wrote this more efficiently or done this same thing a different way.

;QUICK COMMAND TO CREATE A TOP VIEW, FRONT VIEW, SIDE VIEW, AND ISO VIEW IN MODEL SPACE
(Defun c:QUICKVIEWS ()

(setvar "cmdecho" 0)
(command "undo" "begin")

(prompt "\nQUICK VIEWS - Select objects to block ..")
(setq userobjectselection (ssget))
(command "isolateobjects" userobjectselection "")

(command "ucs" "w")
(command "-view" "_swiso")

(prompt "\nQUICK VIEWS - Select lowest bottom left corner ..")
(setq userinsertionpoint (getpoint))

(command "-layer" "s" "3DMODEL" "")
(command "-block" "3D MODEL" userinsertionpoint userobjectselection "")

(command "unisolateobjects")

(command "ucs" "w")
(command "-insert" "3D MODEL" "0,500,0" "1" "1" "0")

(command "ucs" "x" "-90")
(command "-insert" "3D MODEL" "0,0,0" "1" "1" "0")

(command "ucs" "z" "-90")
(command "-insert" "3D MODEL" "0,500,0" "1" "1" "0")

(command "ucs" "w")
(command "ucs" "x" "-45")
(command "ucs" "z" "45")
(command "-insert" "3D MODEL" "603.5534,-103.5534,353.5534" "1" "1" "0")

(command "-layer" "s" "NOTES" "")
(command "ucs" "w")
(command "-insert" "fabtag-xs" "0,-10,0" "8" "8" "0")
(command "-mtext" "0,495" "s" "notes" "j" "tl" "c" "n" "0,495" "{\\LPLAN VIEW}" "")
(command "-mtext" "0,-5" "s" "notes" "j" "tl" "c" "n" "0,-5" "{\\LFRONT ELEVATION}" "")
(command "-mtext" "500,-5" "s" "notes" "j" "tl" "c" "n" "500,-5" "{\\LSIDE ELEVATION}" "")
(command "-mtext" "500,495" "s" "notes" "j" "tl" "c" "n" "500,495" "{\\LFRONT ISOVIEW}" "")

(command "-view" "_top")
(command "zoom" "e")

(setvar "cmdecho" 1)
(command "undo" "end")
)

//first text not showing up
0 Likes
726 Views
11 Replies
Replies (11)
Message 2 of 12

ВeekeeCZ
Consultant
Consultant

I can see it... 

 

eekeeCZ_0-1729110826652.png

 

0 Likes
Message 3 of 12

christian_paulsen98V29
Enthusiast
Enthusiast

I meant up by my cursor when dynamic input is turned on. Kind of like how the second prompt shows right by the cursor.

0 Likes
Message 4 of 12

ВeekeeCZ
Consultant
Consultant

Unfortunately, this is not possible with ssget.

0 Likes
Message 5 of 12

ec-cad
Collaborator
Collaborator

Try adding this (command "_delay" 2000)  between these 2 lines:

(prompt "\nQUICK VIEWS - Select objects to block ..")
(setq userobjectselection (ssget))

 

ECCAD

0 Likes
Message 6 of 12

paullimapa
Mentor
Mentor

just a few fyis:

1. Localize your variables: userobjectselection & userinsertionpoint

 

(Defun c:QUICKVIEWS (/ userobjectselection userinsertionpoint)

 

2. save current system variables instead of assuming what they are ie: cmdecho:

 

; at beginning of code
(setq cmdecho (getvar 'cmdecho)) ; save current cmdecho
(setvar 'cmdecho 0) ; use my settings
...
; at end of code
(setvar 'cmdecho cmdecho) ; restore original setting

 

 3. Make sure not in Layout since only in Model can you set view _swiso

 

(if(zerop(getvar 'tilemode)) ; chk if in layout
  (setvar 'tilemode 1) ; change to Model tab
)
(command "-view" "_swiso") ; then set view command

 

4. You should consider preceding all the AutoCAD commands with an Underscore & Period "_." Underscore means native AutoCAD language command (English). Period will execute command even if it has been undefined. For example:

 

(command "_.-Layer")
(command "_.-View")

 

5. You may also want to consider preceding all the sub commands with an underscore "_" Again Underscore means native AutoCAD language command (English). For example:

 

(command "_.-layer" "_s" "3DMODEL" "")
(command "_.ucs" "_w")

 

6. Some commands like the Layer Set command can be done using setvar. For example the following Layer Set command would stop the lisp code from proceeding if layer 3DMODEL does not exist. So instead of this:

 

(command "-layer" "s" "3DMODEL" "")

 

You can use this:

 

(if (tblsearch "Layer" "3DMODEL")(setvar 'clayer "3DMODEL"))

 

 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
Message 7 of 12

Sea-Haven
Mentor
Mentor

Any reason your not using say a layout with multiple view ports rather than inserting the 3dobject multiple times ? Just set the view direction can use Vpoint.

0 Likes
Message 8 of 12

ВeekeeCZ
Consultant
Consultant

..

6+. make sure the layer is there and is not frozen or off. (command "_.layer" "_t" "NOTES" "_m" "NOTES"...) 

 

0. (0 because it's the most important thing), turn OFF osnaps! When specifying points within the command function, osnaps are enabled by default. Check your OPTIONS setting... 

 

eekeeCZ_0-1729154796768.png

 

 

7. Numbers within the command function could be specified as numbers, not necessarily as strings. Also coordinates could be specified as a list. (command "-insert" "3D MODEL" '(0 0) 1 1 0)

 

8. When inserting blocks, it's better to call the prompts than just fill them (as they are different when the block is scaled uniformly or not)

(command "_.insert" "3D MODEL" "_s" 1 "_r" 0 "_non" '(0 0))

 

9. since you are changing sysvars, you must learn about the *error* function. Your routine should reset the changed sysvar even in case of an error event (eg hitting ESC button)

 

10. better than

(prompt "\nQUICK VIEWS - Select lowest bottom left corner ..")
(setq userinsertionpoint (getpoint))

 

is 

(setq userinsertionpoint (getpoint "\nQUICK VIEWS - Select lowest bottom left corner .."))

 

Unfortunately, the same cannot be done with ssget.

 

11. -layer. The dash prefix is useless. When scripting the command-line version of command is taken automatically. Use just "layer".

 

12. if you want to, you can save yourself some of keyboard strokes...

(command "-layer" "s" "3DMODEL" "")
(command "-block" "3D MODEL" userinsertionpoint userobjectselection "")
...
(command "-mtext" "500,495" "s" "notes" "j" "tl" "c" "n" "500,495" "{\\LFRONT ISOVIEW}" "")
 
all could be grouped into one command.
 
(command "-layer" "s" "3DMODEL" ""
                    "-block" "3D MODEL" userinsertionpoint userobjectselection ""
                  ...
                  "-mtext" "500,495" "s" "notes" "j" "tl" "c" "n" "500,495" "{\\LFRONT ISOVIEW}" "")

 

 

0 Likes
Message 9 of 12

christian_paulsen98V29
Enthusiast
Enthusiast

The company i work for has a very odd process. They have one dwg with the model of the structure called a "z model", then every single part gets its own dwg called a "fab drawing" (which is what this command is for), then every detail or section gets its own dwg.

Thennnnn when working in paper space they create a different dwg for every layout called "parent sheets". In the parent sheet dwgs the model space and paperspace is completely blank and just has all the fab drawings and sections and details xreffed into them.

To answer your question the reason we have to show all of our views in model space and not paperspace is because you cant xref in a paperspace layout, only model space. So in order to xref our fab drawings into our parent sheets it has to be done in model space.

Believe it or not this command im making is actually an improvement on the current process. Right now they take their single model and then flatshot it from the top, front, side, and iso. Then layout all those flatshots in their model space to be xreffed in. Its a ton of extra steps and work to use flatshots, and when the model updates the flatshots dont update.

Its very very confusing and i just took over management for my facility. Streamlining our workflow is a fight ive been losing since i got here.

0 Likes
Message 10 of 12

christian_paulsen98V29
Enthusiast
Enthusiast

Thank you so much for the advice. I have no type of formal education when it comes to coding or anything related. I've gotten good enough to make most of my lisps functional, but most likely not the most optimal. Still learning. Ill play around with it some more using these notes.

0 Likes
Message 11 of 12

paullimapa
Mentor
Mentor

you're welcome...just keep at it...search on-line for various ways to implement certain methods and you'll get lots of excellent examples...just don't go with chatgpt...that's the worse...cheers!!!


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

Kent1Cooper
Consultant
Consultant

@christian_paulsen98V29 wrote:

I meant up by my cursor ....


Would using (alert) instead of (prompt) get you closer to what you're after?  At least it will be up in the drawing area, not down in the Command line.

Kent Cooper, AIA
0 Likes