Insert prompts ?

Insert prompts ?

Anonymous
Not applicable
1,350 Views
9 Replies
Message 1 of 10

Insert prompts ?

Anonymous
Not applicable

I'ld like to insert a block with a given point and rotated towards another point.

but what are the prompts autocad needs?

 

(command "insert" Blockname insertpoint "" "" rotatepoint)

 

 

This doesn't seem to work for me...

Can anyone tell me if I'm missing a prompt or if I'm giving too much data to the "insert"-command?

Where can I find these for other commands (eg. Command "circle" needs a insert point and distance)

 

 

 

Thanks in advance!

Writing a lisp for work but have little experience in autolisp

0 Likes
1,351 Views
9 Replies
Replies (9)
Message 2 of 10

Shneuph
Collaborator
Collaborator

Hello.  Welcome to the forums!

 

A good start is just to complete the task manually.  Then go back and look at what you had to input into the command line.  That is what needs to go into your (command ...) lisp code as well.

 

insert.jpg

 

(command "insert" "elbow-p-i-2-ta" pause "" "45")

 

Pause allows the user to pick the insertion point. "" is like an <Enter>

 

It looks like what you have is close.  Is it giving an error message?  What is in the command line after you try to run it?

---sig---------------------------------------
'(83 104 110 101 117 112 104 64 71 109 97 105 108 46 99 111 109)
0 Likes
Message 3 of 10

Anonymous
Not applicable

I don't have the code with me (at home), but I'll post it tomorrow!

It serves the purpose of inserting a number of blocks situated around an arc, that always has the same arclength, but can have a different radius.

 

 

Thanks for the swift reply!

0 Likes
Message 4 of 10

Kent1Cooper
Consultant
Consultant

@Anonymous wrote:

I'ld like to insert a block with a given point and rotated towards another point.

but what are the prompts autocad needs?

 

(command "insert" Blockname insertpoint "" "" rotatepoint)

 

This doesn't seem to work for me...

 

....

If you are using a new-enough version that Blocks can be defined to be scaled uniformly, and Blockname is so defined, then I expect it would ask for only one scale factor, and one of those "" Enters [which are accepting the default 1 for both X and Y scale factors] should be removed.

 

If that's not the issue, describe in more detail what "doesn't work" means -- doesn't do anything?  Inserts but doesn't get the rotation right?  etc.

Kent Cooper, AIA
0 Likes
Message 5 of 10

Anonymous
Not applicable

Text looks messy here, because I wrote it in Notedpad++ It works up untill I have to select the starting point. This is the error:

 

Command: CFX Select Arc or Centerpoint point Current point modes: PDMODE=0 PDSIZE=0.000 Specify a point: Command: InnerPanel 2.4m / Outerpanel 2.5m ? : o (Counter)Clockwise? : cw Select Outer-Circle: Select starting point STARTANGLE: insert Enter block name or [?] <_ACMFILLEDHALF>: Command: Command: CFX Unknown command "CFX". Press F1 for help. Command: Command: insert Enter block name or [?] <_ACMFILLEDHALF>: Command: Command: CFX Unknown command "CFX". Press F1 for help. Command: Command: insert Enter block name or [?] <_ACMFILLEDHALF>: Command: Command: CFX Unknown command "CFX". Press F1 for help. Command: Command: insert Enter block name or [?] <_ACMFILLEDHALF>: Command: Command: CFX Unknown command "CFX". Press F1 for help. Command: Command: insert Enter block name or [?] <_ACMFILLEDHALF>: Command: Command: CFX Unknown command "CFX". Press F1 for help. Command: Command: insert Enter block name or [?] <_ACMFILLEDHALF>: Command: Command: CFX Unknown command "CFX". Press F1 for help. Command: Command: insert Enter block name or [?] <_ACMFILLEDHALF>: Command: Command: CFX Unknown command "CFX". Press F1 for help. Command: Command: insert Enter block name or [?] <_ACMFILLEDHALF>: Command: Command: CFX Unknown command "CFX". Press F1 for help. Command: Command: insert Enter block name or [?] <_ACMFILLEDHALF>: Command: Command: CFX Unknown command "CFX". Press F1 for help. Command: Command: arc Specify start point of arc or [Center]: c Specify center point of arc: Specify start point of arc: Specify end point of arc (hold Ctrl to switch direction) or [Angle/chord Length]: *Invalid* ; error: Function cancelled code is in pdf (kept getting forum mistake due to faulty html or something).

0 Likes
Message 6 of 10

Anonymous
Not applicable
forum keeps messing up my text.. anyway in pdf is my code can't get it inserted here properly
0 Likes
Message 7 of 10

Anonymous
Not applicable

Sorry for the messy post's above. The forum keeps messing up the format.

 

included the error and code.

 

 

Thanks again!

0 Likes
Message 8 of 10

Shneuph
Collaborator
Collaborator

Make sure cmdecho is set to 1 if not already.  It can help give more prompts to figure out what the problem may be.

 

If these are the block names try passing them to the insert command as a string.

insert.png

e.g. (command "insert" "Langsprofiel_links_zijkant" pt_lp1 "" CENTERPOINT)

 

If the block is (A in the drawing already or (B in the support file search path.  If not, you will need to supply the full path to the file

e.g. (command "insert" "C:\\CAD\\Blocks\\angsprofiel_links_zijkant")

 

Instead of running the full lisp try manually setting values for pt_lp1 and CENTERPOINT.  Then just work with the (command "insert" ...) line until you get that syntax correct.

---sig---------------------------------------
'(83 104 110 101 117 112 104 64 71 109 97 105 108 46 99 111 109)
0 Likes
Message 9 of 10

hmsilva
Mentor
Mentor

@Anonymous wrote:

Sorry for the messy post's above. The forum keeps messing up the format.

 

included the error and code.

 

 

Thanks again!


Hi franssen.wes,

to insert code use the 'insert code' tool

insert code.PNG

and in a quick reading of your code:

 

(if (= CW_CCW "-1")
      (setq LP_HelpAngle STARTANGLE)
      (setq LP_HelpAngle ENDANGLE)
)

CW_CCW is an INT nor a STR...

 

And '-LP_HelpAngle' is nil, you are setting  'LP_HelpAngle' in

 

(if (= CW_CCW "-1")
      (setq LP_HelpAngle STARTANGLE)
      (setq LP_HelpAngle ENDANGLE)
)

 

Hope this helps,
Henrique

EESignature

0 Likes
Message 10 of 10

Anonymous
Not applicable

That did the trick!

Blockname had to be between "    "
+ I had to add an extra pair of "" to fill up a prompt.


thanks! I think I can handle it a bit further from here on out!

0 Likes