Quantcast
Channel: Autodesk India Community aggregator
Viewing all 1680 articles
Browse latest View live

AutoCAD Customization: Visual LISP, AutoLISP and General Customization: Trouble with vla-open and file insert

$
0
0

I'm trying to make a lisp that will either insert a block or open a file depending on user input. It works when I test it line by line, but it doesn't execute well when I run the command. Any suggestions will be greatly appreciated. This is what I have so far.

 

;---------------------------------------------------------------------------------------------

(defun C:LaSetup(/ ANS ONT DISP FILENME ACAPP ACDOCS)


(setq FILENME "P:/Layering/Layers/E0-Elec.dwg")

(setq ans(strcase(getstring "Enter A for all layers F to open File? ( A/F ) :")))
(setq ont "notnil")

(while ONT
(if (= (wcmatch ans "A,F") nil)
(setq ans(strcase(getstring "Input must be 'A' or 'F'")))
(setq ont nil)
)
)

(if (= ans "A")(command "-insert" FILENME "0,0" "1" "1" "0" "erase" "l" ""))
(if (= ans "F") (progn
(setq acApp (vlax-get-acad-object))
(setq acDocs (vla-get-documents acApp))
(vla-open acDocs FILENME)
)
)


);End of file


AutoCAD Customization: Autodesk ObjectARX: Troubles with AcTrayItemBubbleWindowC

$
0
0

My AcTrayItem class insertet in the application status bar work fine
as well from modeless Dialog.
But AcTrayItemBubbleWindowControl appears
only by movement the mouse inside the current document.

From modeless Dialog appear the control infrequent.
The solution with:

<ShowBubbleWindow(&bubble);>
<acedGetAcadFrame()->SetFocus();>
<acedGetAcadDwgView()->SendMessage(WM_MOUSEMOVE, NULL, NULL);>

was unsuccessful, unless, by movement the mouse from Dialog
into document window.

Can anybody help?
 
Regards
Georg

AutoCAD Customization: Visual LISP, AutoLISP and General Customization: Change the ltype in a PLINE drawn

$
0
0

How to change the ltype in a PLINE drawn whith this code:

 

(defun c:cordaluminosa ()
(if (tblsearch "LAYER" "Elétrico - Luminotécnico")(command "_.-layer" "_THAW" "Elétrico - Luminotécnico" "_ON" "Elétrico - Luminotécnico" "_SET" "Elétrico - Luminotécnico""")(command "_.-layer" "_MAKE" "Elétrico - Luminotécnico" "_COLOR" 3 "" ""))
(command "._pline")
(while (wcmatch (getvar "cmdnames") "*PLINE*")(command pause))
)

 

I want to set the ltype FENCELINE1 to this object.

 

Thanks

AutoCAD Customization: .NET: Command Line Switches

$
0
0

How can I open AutoCAD 2011 with command line switches using VB.Net Express 2008 in an external application?

I have AutoCAD Mechanical installed and when I open it programmatically it opens with a profile which was last used interactively (<<ACADMPP>> or <<VANILLA>>). But I want to make sure that it opens with <<VANILLA>> profile only. Programmatically switching the profile does not work and my program crashes.

The program otherwise works fine on a machine where vanilla AutoCAD is installed.

Please help.

AutoCAD Customization: Visual LISP, AutoLISP and General Customization: ScriptPro 2

$
0
0

We have been succesfully using ScriptPro but need to move to ScriptPro 2 to work with newer versions of AutoCAD. Unfortunately there appears to be 1 feature that has been removed that is crucial for us - the ability to set the working directory, as we load DLLs that use the working directory to locate configuration files. Is it possible that this can be done and I have missed it.

AutoCAD Customization: .NET: TRUSTEDPATHS FOR "HEKY_LOCAL_MACHINE"

$
0
0

Hello every one

 

i know how can i put my dll in Trusted Paths for current user

but i don't know how can i put it for all user in  HEKY_LOCAL_MACHINE

 

any help

AutoCAD Customization: Visual LISP, AutoLISP and General Customization: Just do what I asked for, please

$
0
0

Hi,

 

Is there a way Autocad could just do what I asked for, and nothing more?

 

A few examples

- After publishing, the publish dialog auto closes.  I don't wat that.  After publishing dwf I also want pdf.

(I know you can save the list, that's not the point.  If you didn't close the dialog I wouldn't need it)

 

- When selecting a hatch, the ribbon automatically jumps to Hatch Editor.  I don't want that.  Maybe I just want to change the layer.  I can find the Hatch editor my self

Dito for XREFS

 

- I do not want any dialog giving me warnings, about anything.  

If an XREF doesn't get attached, I can see that.  I don't need a dialog telling me.

If a shape file is missing, I can see that ...

A triangle sign above the command line is totaly adequate.

 

Don't auto open or close dialogs, for what ever reason.

 

 

So ... don't auto do anything I can perfectly do manualy.  No doubt there are a few more examples I can't think of right now.

 

The nice thing would be to get a variable that gives me that "no auto" mode.  

I guess a comination of variables do part of what I request, those are welcome too.

 

 

Kind gegards

AutoCAD Customization: .NET: SelectionSet from ObjectIds

$
0
0

I can create a SelectionSet by using SelectionFilters and the Editor select functions.  When I create SelectionSets this way I can use them in a command by calling the Previous selection.  However, if I create entities, store their objectids and then create a SelectionSet by using the SelectionSet.FromObjectIds function, when I call the previous selection on a command nothing is selected.  Is there a way to create a SelectionSet from ObjectIds that would be available to commands? 


AutoCAD Customization: Visual LISP, AutoLISP and General Customization: Line length report

$
0
0

I have got this far. I am trying to create a report of line lengths based on linetype.

 

I have built a list that looks like this...

 

(("CUT4SS" . 859.566) ("CUT4SS" . 862.231) ("CUT4SS" . 927.651) ("CUT6SS" . 1158.48) ("CUT6SS" . 509.903) ("CUT6SS" . 2840.31) ("CUT4SS" . 967.76) ("CUT4SS" . 508.73) ("CUT4SS" . 111.065) ("CUT4SS" . 483.216))

 

I want to take this list and create a function to create a list of total lengths i.e. the CDR's.

(("CUT6SS" .total length)("CUT4SS" . total length))

 

I can do the rest but I'm awfull rusty. Brain freeze.

 

I appreciate the help. Thanks

 

 

AutoCAD Customization: Visual LISP, AutoLISP and General Customization: Replacing text in tables

$
0
0

Consider the following code:

 

(if (ssget "_X" '((0 . "ACAD_TABLE")(1 . "PIPE LIST")))(progn (vlax-for a  (setq ss   (vla-get-ActiveSelectionSet (vla-get-ActiveDocument (vlax-get-acad-object)))) (repeat (setq r (vla-get-rows a))(setq r (1- r) c -1)(repeat (vla-get-columns a)

 

(if (eq "*PL*" (vlax-invoke a 'GetText r (setq c (1+ c)))) (vlax-invoke  a 'SetText r c "THREAD ONE END"))))) (vla-delete ss)));progn);if

 

Basically, it replaces this text inside a table:

 

1 1/2" NPTM - A53 - 3000LB - A-53 - 3000 LB

with:

thread both ends.

 

But I'm limited to the size of pipe, it's material and its pressure rating.  I can't change how the text in the field is populated.  It would be nice if, it did a search for NPTM, and when that string exists in the string, change it to "thread both ends".

 

Essentially right now, I have 46 lines (and growing) of different scenarios.  I just want the NPTM to trigger the string change.

 

Does that makes sense?

 

Thanks

KP

AutoCAD Customization: Visual LISP, AutoLISP and General Customization: Registry Key For Current profile (cprofile)

$
0
0

Which registry Key stores the name of the Current profile ("cprofile")?
I tried following, all reurn 'nil'

(vl-registry-read "HKEY_CURRENT_USER\\Software\\Autodesk\\AutoCAD\R18.1\\ACAD-9005:409\\Profiles")

(vl-registry-read
"HKEY_CURRENT_USER\\Software\\Autodesk\\AutoCAD\R18.1\\ACAD-9005:409\\Profiles\\(default)")

In the registry when I double-click the key, the value is displayed. But I can't access it.

AutoCAD Customization: Visual LISP, AutoLISP and General Customization: Change the colors of all objects in a layer

$
0
0

Hi,

 

Can I have a lisp to select all objects in the layer "Defpoints" (including model and paper space, and including objects inside blocks) and change the color of those objects to color 30?

 

Thanks!

AutoCAD Customization: .NET: Get more informations of solid3d from BREP API

$
0
0

I used Brep API to get all faces, edges or vertices of a solid3d, but i cannot recreate it from these information. Can i get more informations from BREP (such as topology, bulge of arc, ...)

 

Thanks.

AutoCAD Customization: .NET: PnId Database Overrule

$
0
0

Hi!

 

Does anyone know if there is an equivalent ObjectOverrule for the PnId Database?

 

If an entity is copied I dont want certain field values to be copied.

 

I've tried an ObjectOverrule but I can't get the RowId at that point.

 

I also noticed that the field values are set as XData. I edited the XData in my ObjectOverrule but the values still gets copied.

 

Is there a setting at project level to control which fields not to copy?

 

Thanks!

Annse

AutoCAD Customization: .NET: Closing default opened Document after Net Loading a DLL

$
0
0

Hello everybody !

 

Context :

  • AutoCAD Map 3D 2013
  • Visual Studio 2010
  • .NET 4.0, C#, WPF
  • FDO
  • Oracle DataStore

Requirement :

When I start AutoCAD Map 2013, a default document called "Drawing1.dwg" is opened. I use the command NETLOAD to load my assemblies. Final Users don't NETLOAD, an entry in the registry does the job automatically. During Initialization, my application downloads from the database a Template DWT file to initiate automatically the connection to the DataSource, and shows the different layers and styles configured by the customer. A new drawing based on this DWT is then generated.

However, the first default document remains opened. It can be sometimes annoying for the user to have both documents opened. I've never found a nice solution to close this first default document.

 

My technical implementation, not working :

In the Initialize method coming from IExtensionApplication, I start my application (loading business classes, user interfaces, etc...). Once started, I download the DWT, and add a new Document to the DocumentCollection (Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager). To this new Document, I handle many events such as CommandWillStart, CommandEnded, CommandFailed, etc... At this time, my Application asks to the user to log in. And finally, I browse the whole DocumentCollection to try to close all documents that are not the new one based on the DWT.

 

        DocumentCollection doc_coll = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager;
        _kleverageDocument = doc_coll.Add(dwtFilePath);

 

                    if (_kleverageDocument != null)
                    {
                        _kleverageDocument.ImpliedSelectionChanged += new EventHandler(doc_ImpliedSelectionChanged);
                        _kleverageDocument.CommandWillStart += new CommandEventHandler(doc_CommandWillStart);
                        _kleverageDocument.CommandEnded += new CommandEventHandler(doc_CommandEnded);
                        _kleverageDocument.CommandFailed += doc_CommandFailed;
                        Takm.Infrastructure.Commanding.TakmCommands.DisplayShellCommand.Execute(true);
                    }

 

            foreach (Document doc in Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager)
            {
                if (doc != _kleverageDocument)
                {
                    try
                    {
                        doc.CloseAndDiscard();
                    }
                    catch (System.Exception ex)
                    {

                    }
                }
            }

 

When I call the CloseAndDiscard method for each of the other Documents, I always get an Exception telling me that the document is currently drawing. Actually, the command "NETLOAD" is stil running. How can I do ?

 

 

I tried another way, by using handled events on DocumentManager :

                    Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.DocumentActivationChanged += DocumentManager_DocumentActivationChanged;
                    Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.DocumentBecameCurrent += DocumentManager_DocumentBecameCurrent;

But it's not really working better ... The behavior is quite strange.

 

Can someone help me ?

Thanks a lot. ;)

 

tom.

 


AutoCAD Customization: .NET: 3rd party software: What will it take to run on AutoCAD 2014?

$
0
0

We use a third party software. The company is always way behind others.

What does it take to prepare software to run on AutoCAD 2014 that currently runs on AutoCAD 2013?

 

Is it just a recompile, or what else?

AutoCAD Customization: Visual LISP, AutoLISP and General Customization: Visual lisp editor

$
0
0

I put breakpoints in my lisp but the visual lisp run through anyway. It was working well yesterday?

Any thoughts?

AutoCAD Customization: Visual LISP, AutoLISP and General Customization: Get cell value from a table

$
0
0

Hi all,

I have set up several tables inside autocad that have one cell as the input cell and after regen the others perform calculations based on that cell. I want to write a command that uses the same value as the input value to draw the arc to scale. I tried using the table value as is called out in the cell field: ^C^C_arc 36,6;e;0,6;r;Table(8796085192704).A3;. Is there anyway to get a value from a cell inside autocad and put it into my macro so I can draw an arc of the radius shown?

Thanks for all your help

AutoCAD Customization: Visual LISP, AutoLISP and General Customization: Thaw layers from custom dialogue box?

$
0
0

First, I am not a programmer but I can do SOME modification to lisp routines here and there.

 

I am trying to find a command that will pull up a dialogue box with all layers that are frozen and be able to select one or more to thaw from that list. I hate the layer manager, it's too slow especially when I have a ton of layers to deal with.

 

I have searched the internet and the discussion groups for something like this to no avail :(

Any body have such a command or know how to do this?

AutoCAD Customization: Visual Basic Customization: C# connection to Autocad LT 2014

$
0
0

Hi all!

 

I have a c# connection, this code run fine in Autocad 2014. The final purpose of my program is create a .dwg file and add labels in mentioned .dwg file but not work in Autocad LT 2014 .

 

My code:

 

try
{

// Upon creation, attempt to retrieve running instance
m_AcadApp = (AcadApplication)Marshal.GetActiveObject("AutoCAD.Application.19");
m_bAcadInit = true;
}
catch
{
try
{
// Create an instance
m_AcadApp = new AcadApplication();
m_bAcadInit = true;
} catch(Exception ex)
{
MessageBox.Show("An error occurred trying to open the AutoCAD.", "Attention", MessageBoxButtons.OK, MessageBoxIcon.Information);

//In LT version this message appears

}

 

Is possible open Autocad LT 2014 with my code or similar code?

 

Thank you very much.

Viewing all 1680 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>