Announcements

Starting in December, we will archive content from the community that is 10 years and older. This FAQ provides more information.

Need to automate open, join, set to origin and save.

Anonymous

Need to automate open, join, set to origin and save.

Anonymous
Not applicable

Greetings,

I am in need of automating the open, join, set to origin and save commands for a set of DXF files that contain an individual 2D shape consisting of x lines segmented together.  I am currently using ACAD LT 2019.  Tried the scripting route though don't seem to be able to accomplish this via script.  example script below:

OPEN "F:\Test1.dxf"
SELECT
ALL

JOIN
ALL

Open and select seem to work but cannot get beyond Join.  If I do the commands manually as below:

Opening an AutoCAD LT 2018/AutoCAD 2018 DXF file.
Regenerating model.
*Cancel*
Command:
Command:
Command: JOIN
Select source object or multiple objects to join at once: all
4 found
Select objects to join:
4 objects converted to 1 polyline

 

The polyline is generated as expected.

 

Any insight, suggestions, or examples would be greatly appreciated.

 

Many Thanks,

 

Chuck

0 Likes
Reply
Accepted solutions (1)
948 Views
8 Replies
Replies (8)

pendean
Community Legend
Community Legend
Why SELECT ALL followed by JOIN ALL in your script? doesn't the second "all" just hand JOIN since you already selected ALL? Tap that commandline, expand it to see a dozen or more lines and see for yourself, what does it say between SELECT ALL and the end of your JOIN ALL instructions?

Either use SELECT ALL the JOIN and finish the command, or skip SELECT ALL and use JOIN ALL.

And remember, JOIN command has to told to finish by you hitting <enter> at the commandline, do the same in your script by adding empty lines for each <enter> you need to finish the command.

0 Likes

Anonymous
Not applicable

skipped select all so script is:

OPEN "F:\Test1.dxf"
JOIN
ALL

with blank line after ALL to complete operation.

 

command line results read:

 

Command: JOIN
Select source object: ALL
*Invalid selection*
Expects a point or Last

 

script JOIN doesn't seem to act same way as if manually written which manual result is:

Command: JOIN
Select source object or multiple objects to join at once: all
4 found
Select objects to join:
4 objects converted to 1 polyline

 

 

0 Likes

pendean
Community Legend
Community Legend
I can confirm JOIN>ALL does not work in a script or in a button macro in LT2019: it only wants the choices Last or for you to manually select the objects. Interesting limitation.

0 Likes

Anonymous
Not applicable

any idea if this would work properly via script in full ACAD?

0 Likes

pendean
Community Legend
Community Legend
LISP, not script or macro, in Full AutoCAD: the LISP forum is over here or help with coding https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/bd-p/130

Post a sample DWG file along with your note, do not mention LT or they can go on tangents... .
0 Likes

steven-g
Mentor
Mentor
Accepted solution

you can use the join option of the "Pedit" command, try this sequence

pedit
m
all
*
j
0
*

I placed an * to show where a blank line should be (the one at the end is important).

Anonymous
Not applicable

YES!.  Works like a charm.  You da man Steven.

 

Cheers

0 Likes

fanuel.gebreyesusX2N3P
Observer
Observer
It works fine.
Thanx!
0 Likes