Scripting Questions

Scripting Questions

Anonymous
Not applicable
707 Views
6 Replies
Message 1 of 7

Scripting Questions

Anonymous
Not applicable

Civil 3D 2021 Batch Save Utility

 

I have a couple bugs to work out of a script that I am using with the Batch Save Utility. The utility uses AcCoreConsole to execute the commands.

 

One is the command PSELECT. I'm trying to select everything and set certain properties to Bylayer. The script is:

;------------------------------------------
; Change all LW, LT and Color to bylayer
;------------------------------------------
pselect all
change p lw bylayer lt bylayer C bylayer

 

Log file shows: Command: pselect Unknown command "PSELECT". Press F1 for help. PSELECT works fine in a regular session.

 

The second problem is with a Map3D command, MAPCSASSIGN, which assigns a coordinate system to the drawing. Script:

;------------------------------------------
; Change Coordinate System to WISCRS Dane Co Ft
;------------------------------------------
MAPCSASSIGN WISCRS2011-DaneF

 

Log file returns: Command: MAPCSASSIGN Assign a Coordinate System to the drawing. Empty to remove.
Code: WISCRS2011-DaneF

 

Which looks just like it does in a regular session, but the coordinate system doesn't change.

 

Anyone have any ideas how I can get these two commands to work?

0 Likes
708 Views
6 Replies
Replies (6)
Message 2 of 7

CodeDing
Advisor
Advisor

@Anonymous ,

 

PSELECT is undocumented, but is only used from the properties menu to allow you to select entities. This serves no practical purpose for what you are trying to accomplish... Try CHPROP instead:

chprop all ...

 

For your MAPCSASSIGN issue.. Perhaps it will not let you assign one if another is already assigned..

Try running MAPCSASSIGNNONE first, then continue as normal..

MAPCSASSIGNNONE
MAPCSASSIGN WISCRS2011-DaneF

 

Best,

~DD

0 Likes
Message 3 of 7

CADaSchtroumpf
Advisor
Advisor

I think AcCoreConsole only executes command for a classic autocad and ignores command for vertical products.
The script stops outright without an error message.
AcCoreConsole is only a light interface of a classic Autocad without graphic mode.

I already had this problem with Map3d, where a script working with the SCRIPT command in GUI, no longer working with AcCoreConsole.

Message 4 of 7

Anonymous
Not applicable

Thanks for the advice.

 

Unfortunately, the coordinate system doesn't change to none, either. I have no idea, but I can always use ADESETCRDSYS to assign the coordinate system to multiple files.

 

And I tried CHPROP all lw bylayer lt bylayer C bylayer but it hangs the app. This was just going to be an added clean up when we batch the files. I'm not sure why it doesn't work, but it isn't a huge deal.

 

I appreciate your looking at it!

I'm an amateur at this, but it'd be nice to make it work, and know why it did or didn't.

0 Likes
Message 5 of 7

Anonymous
Not applicable

@CADaSchtroumpfthat makes sense. I thought maybe it had to load a module first and tracked the command to a dll in the Map folder, but NETLOADing the dll didn't work either. I think I am out of luck with the coordinate system.

0 Likes
Message 6 of 7

CodeDing
Advisor
Advisor

@Anonymous ,

 

Random fun fact, after using strictly vanilla AutoCAD a while back and experimenting with where/how the coordinate system was stored for that (because you assign a coordinate system for bing map imagery), I stumbled across where Acad stores the data for geographic location. It seems like this is the entity you would want to edit to update your geo location... Now, with that being said, I have no idea how to do it.. But with all the smart people around here, I'm sure somebody can figure it out. Just food for thought.

NOTE: You will NEED to have a coordinate system assigned for this function to return anything.

(defun GetGeoData ( / )
  (dictsearch
    (cdr (assoc 360 (entget (cdr (assoc 330 (entget (tblobjname "BLOCK" "*Model_Space")))))))
    "ACAD_GEOGRAPHICDATA"
  );dictsearch
);defun

Best,

~DD

Message 7 of 7

Sea-Haven
Mentor
Mentor

Entget the dictsearch will go the next level Not tested but tested on SORTENTS, then have to look into each assoc answer.