AutoCAD .NET :: Event For Change Active Layer In Document
Aug 24, 2012
Is there event for change current (active) layer of document?
(it's not Database.ObjectModified - it's not raised).
I tried to do it with binding as:
public void Initialize()
{
var layerList = Application.UIBindings.Collections.Layers;
layerList.PropertyChanged += new PropertyChangedEventHandler(LayerList_PropertyChanged);
And -= in Terminate, but... Autocad 2012 chashed _sometimes_!!!
Impossible to understand when it happened. So I reject this way. Is there other way to handle this event?
View 2 Replies
ADVERTISEMENT
Sep 30, 2013
I would like to make the active layer name the same as the document name. I know very little about scripting. I found this script:
var idoc = app.activeDocument;var ilayer = idoc.activeLayer;var filename = idoc.name;ilayer.name = filename;
It does almost what I need it to do. except that it also copies the ".ai" in to the layer name. Is there some way to modify this script to have it exclude or delete the file extension?
View 4 Replies
View Related
Jul 30, 2012
I write plug-in for AutoCAD in C# and I have a question. How I can change dws-file in active document?
I know how it's doing in LISP, but not in C#.
View 1 Replies
View Related
Sep 20, 2012
I'm trying to change the active document window size with vb.net. This seems like it should be straightforward, but I'm having some trouble. Below is some code that I tried to use which I found on the AutoCAD DevBlog.. I thought I understood how this works, but I can't seem to import the correct references to make it work.
Dim doc As Document = Application.DocumentManager.MdiActiveDocument()
Dim docWindow As Window = doc.Window
Dim size As Size = docWindow.Size
docWindow.WindowState = Window.State.Normal
docWindow.Size = New Size(500, 500)
View 4 Replies
View Related
Sep 27, 2013
Is there a script to convert a layer or layer group to a 32-bit image rather then the entire active document at present that is the only option in Ps 5.x.
View 4 Replies
View Related
Feb 15, 2014
Apparently, in the CS3 is impossible to do any scripting and using any actions. Can it be done using plugins sdk, without creating a new document? I tried using the functions SetPageSetup and SetCropBox but no effect
View 6 Replies
View Related
Mar 3, 2013
Okay my script to change text frame color changes the color of all text frames hidden or not.
I need it to only change visible text frames.
if ( app.documents.length > 0 ) {
newCMYKColor = new CMYKColor();
newCMYKColor.black = 0;
newCMYKColor.cyan = 0;
newCMYKColor.magenta = 0;
newCMYKColor.yellow = 0;
[Code]...
How to go about making it only change the color of text frames on the active layer? In the final script I will hide all other layers so if it could be done by a visible attribute more easily that would work just as well.
View 4 Replies
View Related
Nov 3, 2011
Is there a way to set the event trigger of an ilogic file that's already inside of a document? I have code that can automatically create and populate new rules across my assembly parts, but it would be nice to set certain rules to fire every time that part gets saved.
If it can't be accomplished outright from the API, would it be possible to throw an OnEvent (save event in this case) inside of the iLogic code, to get the same results? URL...
View 8 Replies
View Related
Jan 24, 2013
How can I stop changing active document? I was thinking I could use this, but I don't know how to cancel it in the event handler:
AcadApp.DocumentManager.DocumentToBeActivated += new DocumentCollectionEventHandler(DocumentManager_DocumentToBeActivated);static void DocumentManager_DocumentToBeActivated(object sender, DocumentCollectionEventArgs e){ // Messagebox to ask if user are sure bool AreYouSureYouWantToChangeActiveFile = MessageBox.... if(!AreYouSureYouWantToChangeActiveFile) //cancel change active file somehow...???}
View 6 Replies
View Related
Jan 5, 2014
I would like to turn off all the existing layers in active document. I have found in developer's guide how to turn off one layer with specified layer name but can not apply it on all layers with any layername.
I tried to get all the Object ID's in layer table and then for each object turn layer off but seems that it does not work.
<CommandMethod("FilterLayers")> _Public Sub FilterLayers()'' Get the current document and databaseDim acDoc As Document = Application.DocumentManager.MdiActiveDocumentDim acCurDb As Database = acDoc.Database'' Start a transactionUsing acTrans As Transaction = acCurDb.TransactionManager.StartTransaction()'' Open the Layer table for readDim LayerTable As LayerTable = acTrans.GetObject(acCurDb.LayerTableId, OpenMode.ForRead)Dim LayerTableRecord As LayerTableRecord = acTrans.GetObject(LayerTable.ObjectId, OpenMode.ForWrite)For Each ObjectId In LayerTableLayerTableRecord.IsOff = TrueNext'' Save the changes and dispose of the transactionacTrans.Commit()End UsingEnd Sub
View 3 Replies
View Related
Jul 22, 2012
I have an external drawing processor and one of the functions is to read the layers in an AutoCAd drawing and if the name matches freeze/thaw it. With modifications over the years I have had it working with 2002 through 2008. Now I'm getting errors. When I tru to use the Interop, I get "Call Rejected by Callee" errors, when I use the
ApplicationServices method to get the application and active document, I getI" Method 'GetEnumerator' in type 'Autodesk.AutoCAD.DatabaseServices.LayerTable' from assembly 'Acdbmgd, Version=18.2.0.0, Culture=neutral, PublicKeyToken=null' does not have an implementation." errors.
Basically for the interop method I use this
Imports Autodesk.AutoCAD.Interop Public Function GetAcadApp() As AcadApplication Dim progID As String = My.Settings.strAcadProgID Dim acApp As AcadApplication =
[Code]......
View 2 Replies
View Related
Oct 22, 2012
I'm trying to get the value of the Category iproperty of the model on the active drawing sheet. This is not a problem in a single sheet drawing, but I'm not sure how to specifically retrieve the Referenced Document of the Active Sheet in s multi sheet drawing.
Here's what I have:
Option Explicit
Public Sub PartsListFilter()
'set reference to the drawing document
'assumes that a drawing is active
Dim oDraw As DrawingDocument
Set oDraw = ThisApplication.ActiveDocument
[code]........
View 1 Replies
View Related
May 3, 2013
Is there a macro or lisp file that allows you to click on a element in the xref or active file and turn it off?
View 5 Replies
View Related
Sep 3, 2013
Have been working on a little something and would like to know what units the user is using in their document. Basically what is selected here:
The thing is, no matter what is there (and while all other menus and such use the units) Active Document.unit stubbornly returns inches. Is there a way to get the proper ones using VBA?
View 3 Replies
View Related
Oct 24, 2011
Is it possible to get the list of all the fonts and colors used in the active illustrator document (.ai file) ?
if yes then how?
View 6 Replies
View Related
Mar 16, 2014
We need a script that select all pattern objects in the active document in illustrator.
View 5 Replies
View Related
Mar 23, 2009
I'm trying to set the active Layer filter. I tried myDB.LayerFilters.Root.Name = "Filter1" but it wouldn't work.
View 9 Replies
View Related
Jul 22, 2013
How do I get my text from my TextBox1 (add text) by pressing my CommandButton1 (okay) to my active page or document?
View 1 Replies
View Related
Jul 12, 2012
Dim editor As Editor = Application.DocumentManager.MdiActiveDocument.Editor
Dim db As Database = HostApplicationServices.WorkingDatabase
Dim tr As Transaction = db.TransactionManager.StartTransaction()
[Code].....
the only prob is : I want selec all block but not the block on layer frozen, off or not visible...
I can check all layer stat on each block.. (i do that already for check each block (name) but i want a solution more easy.)
View 5 Replies
View Related
Aug 23, 2011
There is a method for extruding ignoring the actual active layer, so the extrussion result is the same as 2D base object...(and is not created in active layer) i forgot how coul i do this, is really useful
After Googling a lot i didn't get any result
View 3 Replies
View Related
Dec 21, 2012
I have a form with a combobox and a commandbutton.
All layers in the layermanager must be locked except the active layer chosen in the combobox. I try it with this code but it’s not the right solution.
Private Sub CommandButton1_Click()Dim layer As AcadLayer'check if all layers are lockedIf layer.Lock = False Thenlayer.Lock = True'make the layer selected in the combobox currentThisDrawing.ActiveLayer = ThisDrawing.Layers.Item(ComboBox1.Text)End SubPrivate Sub UserForm_Initialize() Dim layerColl As AcadLayers Dim layer As AcadLayer Dim LayList As String ' all layers locked For Each layer In ThisDrawing.Layers If layer.Lock = False Then layer.Lock = True End IfNext 'fill combobox Set layerColl = ThisDrawing.Layers For Each layer In layerColl ComboBox1.AddItem layer.Name Next End Sub
2. When I choose the for next method to lock all layers (40 layers) it’s very slow.
View 4 Replies
View Related
Jun 20, 2012
Changes all dimensions, balloons, ect (define more if you want) to current object default in active standard.
Sub ChangeDimStyle()'J.Kriek 2012 Dim oApp As Application Dim oIdw As DrawingDocument Dim oDim As DrawingDimension Dim oBalloon As Balloon Dim oDimStyle As DrawingStandardStyle Dim oSheet As Sheet Set oApp = ThisApplication
[Code]....
View 9 Replies
View Related
Sep 2, 2011
I am trying to have one drawing with B size and E size sheets I am trying to get the border, title block and standard to change when the sheet format changes. I can get it to work when I run the rule but have hard time find information to just change when sheet format changes. And I can't find anything or I should say a sample of how to. I think I found the code just don't know how to make it work. Here is what I have so far.
SubMain()
IfActiveSheet.Size="E"Then
ActiveSheet.TitleBlock="G&T (E)"
ActiveSheet.Border="G&T Border (E)"
EndIf
IfActiveSheet.Size="B"Then
[code].......
View 9 Replies
View Related
Jul 29, 2013
I have an Ipart I would like to have a Ilogic form to change the active Ipart. I tried iPart.ChangeRow but I did something wrong and it doesn't work.
View 2 Replies
View Related
Aug 2, 2013
I have a button which has a mousover/mousout animation. When i click the button, it will shrink down to 0%. when it does, my mousout event is triggert, which i dont want.
how can i disable the mousout event after the click event?
View 4 Replies
View Related
Jul 16, 2013
Within an IDW file, you can go to the Styles Editor, then click on a standard. On the General tab, there's a drop down for the unit of length.
Provide the code so that I can change this setting from Inches to mm with an iLogic rule?
View 2 Replies
View Related
May 12, 2012
I feel really dumb right now but for some reason I'm having trouble deselecting. First off, I'm talking layers and vector objects here. I know Cmd D deselects selections. But how you do deselect any layer which might currently be active? I'm working in PS CS6 for the first real time and it's like I suddenly got dumb or something.
I know you can select a blank area of the Layers Panel to do it, but my Layers Panel is full right now, so I don't even see any dead space. This is especially troubling because I'm making a lot of shape layers and if I do that while a layer is selected then I wind up making masks.
View 7 Replies
View Related
Nov 11, 2008
If I am working on a layer, then select a new layer to work on, then paint on that layer, then undo: the brush stroke is undone, but also the previous layer I was working on re-becomes the active layer. I want it to stay on the new layer I selected. Is there an option for this?
View 1 Replies
View Related
Dec 6, 2011
New user: I erased the background (BG) on the image I have so it is transparent. Saved as PNG. Now how do I put the new BG? I know I have to get the new BG on an active layer. Then, do I copy the FG (Foreground) image and paste somewhere. IOW how to merge the two? Must they be same size etc?
View 2 Replies
View Related
Jun 15, 2013
When you try to rescale a layer using the Rescale Tool with a layer mask active, it scales of the mask, likewise if you select the layer it will scale the layer. Can I select both the layer and layer mask and scale the layer, thus it keeps the layer mask showing the desired masked area only. As the only way I can see currently is by applying the layer mask on the layer and then you can see the layer/s below to get the scaling that is desired. But I would like to keep the layer mask active for editing after scaling.
View 4 Replies
View Related
Sep 24, 2012
Is it possible to lock a layer within a document and password protect that specific layer?
View 3 Replies
View Related