Script Issue

Script Issue

Anonymous
Not applicable
1,717 Views
14 Replies
Message 1 of 15

Script Issue

Anonymous
Not applicable

I am trying to write a Script to join lines and offset them but when I am typing "join" "enter" "all" "enter" is working in command bar but Script is not working when I am running the Script. I wrote with Notepad like Exp. below :

 

select

all

 

join

all

 

 

"all" is not working in AutoCAD with Script I wrote with Notepad but is working in another CAD program like Micro survey 2016. Can you please tell me why ?

0 Likes
Accepted solutions (3)
1,718 Views
14 Replies
Replies (14)
Message 2 of 15

john.vellek
Alumni
Alumni

Hi @Anonymous,

 

Welcome to the Autodesk Community!

 

Can you give me the exact script (SCR) that you are trying to run? Or, is this a diesel script assigned to a button or key?

 

I tried your steps at the command line and yes they work fine. I then used the Action Recorder to do the same thing and it seemed to work fine as well.


John Vellek


Join the Autodesk Customer Council - Interact with developers, provide feedback on current and future software releases, and beta test the latest software!

Autodesk Knowledge Network | Autodesk Account | Product Feedback
0 Likes
Message 3 of 15

Anonymous
Not applicable
-LAYER
SET
HOUSE
 
-LAYER
FREEZE
*
 
PEDIT
all
y
join
fil
la
house
 

OFFSET
0.45
l
35981.125,5426.236
35981.125408,5426.236179,0.000000
 
CHANGE
l
 
properties
la
overhang
 
-LAYER
THAW
*
lt
hiddenx2
 
properties
lt
hiddenx2
 
EXPLODE
fil
la
house
 
EXPLODE
fil
la
overhang
 
_STOPSCRIPT
0 Likes
Message 4 of 15

Anonymous
Not applicable

I am using this Script in Microsurvey 2016 to draw overhang and is working very well but I have tried to use that with AutoCAD 2017 unfortunately didn't work. The problem is selecting option when we are typing "all" is going to say *Invalid selection*.

 
 
 
 
 
 
 
 
 
 
0 Likes
Message 5 of 15

gdefilo
Advocate
Advocate

Hi asarafrazi,

 

welcome to this Community!

 

Tell us: what are you trying to do?

Do you know that the "join" command works only with objects with an endpoint in common?

If you try to run the join command on a selection of "all" objects, could not work at all if there's no line (or arc, or polyline...) with an endpoint in common with another line (or arc, or polyline...).

 

You can obviously try.

I would do like this:

_join;all;;

the semicolon works like an <enter>, so remember not to put an enter at the end of the line.

 

 

Hope this helps,

Giancarlo

 

Message 6 of 15

john.vellek
Alumni
Alumni

Hi @Anonymous,

 

I will take a look to see if I can find a work around. It might be as simple as a Zoom Extents before doing that....I will update my post with my findings.


John Vellek


Join the Autodesk Customer Council - Interact with developers, provide feedback on current and future software releases, and beta test the latest software!

Autodesk Knowledge Network | Autodesk Account | Product Feedback
Message 7 of 15

Anonymous
Not applicable

Hi John, Thank you so much for your help.

This is better Exp.: "all" at the end is not working

 

-LAYER
SET
HOUSE
 
-LAYER
FREEZE
*
 
pedit
all
y
join
all
 

offset
0.45
all

 

0 Likes
Message 8 of 15

gdefilo
Advocate
Advocate

Of course I answered before you posted your script.

 

I thought you were working on the "join" command.

 

I'm glad I could help, anyway.

 

Now the issue is you can't offset all objects, isn't it?

Well, in AutoCad you can't. Only one object at a time. You have to tell the application which side of the object you want the offset to be put.

 

Hope this helps,

Giancarlo

 

Message 9 of 15

Anonymous
Not applicable

Hi

g.defilo, Thank you for your reply, The problem is if I want to type in command bar like : Select;all;; then offset; 0.45; 35981.125408,5426.236179; is working but when have tried to type in notepad for script didn't work. I don't know why ?!

 

 

0 Likes
Message 10 of 15

john.vellek
Alumni
Alumni
Accepted solution

Hi @Anonymous,

 

(SSGET "L") will give you the last element but when you use it with Offset in a script it needs manual input of the side to offset to.

 

So I used Action Recorder in AutoCAD 2017 to record the steps. It works ok for me but of course does not have any error checking that a LISP routine would include if well written.

 

The trickiest part is of course the Offset command in the macro. While recording it I used:

Offset

0.45

(SSGET "L")

Then a pick point for the offset side

 

You can put this macro in your Actions Recording File Location and try to run on your system.

Capture.PNG

 

 


John Vellek


Join the Autodesk Customer Council - Interact with developers, provide feedback on current and future software releases, and beta test the latest software!

Autodesk Knowledge Network | Autodesk Account | Product Feedback
0 Likes
Message 11 of 15

dmfrazier
Advisor
Advisor

I can't answer why it's not working in 2017 - it works fine in 2013 - but I can offer an alternative: instead of the 2nd "All", try "P" for previous.

0 Likes
Message 12 of 15

Anonymous
Not applicable

Hi, I did with "p" "last" "all" but didn't work... 

0 Likes
Message 13 of 15

Anonymous
Not applicable

Thank you so much for your help but didn't work 😞 for me . 

0 Likes
Message 14 of 15

gdefilo
Advocate
Advocate
Accepted solution

Well,

 

we were here:

 

-LAYER
SET
HOUSE
 
-LAYER
FREEZE
*
 
pedit
all
y
join
(ssget "_X")
 

offset
0.45
all

 

 

The ssget expression should select everything in the drawing.

But still I don't get what to do with the offset sequence. There is a way to male it work but it will only for the first line (or polyline) selected.

Better than a script, build a button macro. All the spaces that represent the <enter> function can be substituted with a semicolon.

So, the whole sequence could be:

 

-LAYER;SET;HOUSE;FREEZE;*;;PEDIT;ALL;Y;JOIN;(ssget "_X");;;OFFSET;0.45;\35981.125,5426.236;

 

You notice the backslash after the offset distance? That means that the command must wait for a selection, so you can pick a line or a polyline.

Then it will go on, but it will do only the first offset automatically.

 

Hope this helps,

Giancarlo

 

 

0 Likes
Message 15 of 15

Anonymous
Not applicable
Accepted solution

Thank you so much guys. Finally with your help I could write the script I want to use :

 

-LAYER
SET
HOUSE
 
-LAYER
FREEZE
*
 
pedit
all
y
join
(ssget "_X")
 

offset
0.45
(SSGET "L")
35981.125,5426.236
 
-layer
thaw
*
 
explode
(SSGET "L")
 
0 Likes