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

AutoCAD Customization: Visual LISP, AutoLISP and General Customization: DCL help. Toggle selection with hide dialog conditional??

$
0
0

Hey everyone...alright here's the skinny. I'm making a pretty complicated custom application to send block attribute information into excel. In constructing the DCL I'd like to have a toggle for "Select *ALL* blocks" and/or "Pick Blocks" or "Standard Instrument Selection". Two of these would be toggle checkboxes, that I'd like to force the user to only be able to have one selected. I.e. if they choose the toggle for "Select *all* blocks" then it would switch the check mark out of "Pick Blocks" or "Standard Instrument Selection" and every iteration of those. I believe this is common with toggles I just do not know the code for it.

Additionally, if they select "Pick Blocks" i wish to hide the dcl and allow them to complete a ssget. I know the code to hide the dcl as well as the ssget, but what I don't know is how to interact with the other toggles in this catagorey. If they select "pick blocks" which is a button, to be able to hide the dcl, i want it to count as the selection of toggles and therefor remove any "checkmarks" for selected toggles: "Select *ALL* blocks" and/or "Standard instrument selection".

I hope this explination was clear enough but here's a pic of the dcl to help out!

(currently I have just two toggles showing but I believe I want to rename "select blocks" TOGGLE to "Standard Instrument Selection" and do the SSget automatically based on a defun that will correspond to that selection.

So, again....1 of the 3 options for toggles only, not 2 selections. If they press the button hide DCL immediately, if they choose one of the toggles the "Okay" button will need to have different done dialogs? If someone could help me with this I would appreciate it greatly.

dcl2.jpg


AutoCAD Customization: .NET: moving Z coordinate on MLeader objects

$
0
0

Hi, I'm hoping somebody can help me out here. I have some multileader objects that have a Z-coordinate that I need to put to 0. I have been successfull with Mtext and Dtext, but i'm struggling with the multileader. This is what I have so far. Don't get any errors, but it does not move to a Z value of 0.

 

If myPSR1.Status = PromptStatus.OK Then
                    acSSet = myPSR1.Value
                    Dim trans1 As Transaction = myDocument.TransactionManager.StartTransaction
                    Try
                        For Each selObj In acSSet
                            Select Case selObj.ObjectId.ObjectClass.Name
                                Case "AcDbText"
                                    Dim textObj As DBText = trans1.GetObject(selObj.ObjectId, OpenMode.ForWrite, False, True)
                                    OrigX = textObj.Position.X
                                    OrigY = textObj.Position.Y

                                    Newpt = New Point3d(OrigX, OrigY, 0)
                                    textObj.Position = Newpt

                                Case "AcDbMText"
                                    Dim mtextObj As MText = trans1.GetObject(selObj.ObjectId, OpenMode.ForWrite, False, True)
                                    OrigX = mtextObj.Location.X
                                    OrigY = mtextObj.Location.Y

                                    Newpt = New Point3d(OrigX, OrigY, 0)
                                    mtextObj.Location = Newpt

                                Case "AcDbMLeader"
                                    Dim mtextObj As MLeader = trans1.GetObject(selObj.ObjectId, OpenMode.ForWrite, False, True)
                                    Dim basePoint As Point3d
                                    Select Case mtextObj.ContentType
                                        Case ContentType.BlockContent
                                            basePoint = mtextObj.BlockPosition
                                            OrigX = mtextObj.BlockPosition.X
                                            OrigY = mtextObj.BlockPosition.Y
                                            Newpt = New Point3d(OrigX, OrigY, 0)
                                            mtextObj.BlockPosition = Newpt

                                        Case ContentType.MTextContent
                                            basePoint = mtextObj.TextLocation
                                            OrigX = mtextObj.TextLocation.X
                                            OrigY = mtextObj.TextLocation.Y
                                            Newpt = New Point3d(OrigX, OrigY, 0)
                                            mtextObj.TextLocation = Newpt
                                    End Select

                            End Select
                        Next selObj
                        ' all ok, commit it
                        trans1.Commit()
                    Catch ex As Autodesk.AutoCAD.Runtime.Exception
                        MsgBox("A problem occured because " + ex.Message)
                    Finally
                        ' whatever happens we must dispose the transaction
                        trans1.Dispose()
                    End Try
                End If

 Any help or guidance would be greatly appreciated.

 

thanks

 

cj

 

AutoCAD Customization: .NET: Copying ACAD ribbon panel to custom ribbon tab

$
0
0

I have custom ribbon tabs created using Autodesk.Windows.RibbonTab.  I would like to copy AutoCAD's Windows panel from the standard View tab to my custom tab.  The wrinkle is that the ACAD.cuix is loaded as partial to our custom Enterprise menu, and the View tab is not loaded in the workspace.  I think this is possible, but haven't been able to assemble the right API calls to do it.  I would greatly appreciate assistance with some sample code.

Best Regards,

Pete Elliott

AutoCAD Customization: Visual LISP, AutoLISP and General Customization: Modify LISP to add line offsets

$
0
0

The following code is modified slightly from a LISP written by hmsilva. It does the exact same thing except it uses a different block, and then offsets the selected polyline 1' to either side onto the appropriate layer. It works, but only when I am zoomed in on the polyline when I pick it. If I am zoomed out, then it offsets 1' to one side, but then it seems to offset the new line back 1' to be on top of the other line. In the attached .dwg file, you can see two examples. The top line was picked when zoomed out, and the bottom line was picked when zoomed into one end of the line. The code below is attached in a LISP file as well. Just wondering if there is something I can do to make it offset properly every time.

 

Thanks!

 

(defun c:KRAIL2
       (/ ANG CUR_LAY DIST1 ENDPT INSPT LEN PATH PICKPT SEL STARTPT)
  (vl-load-com)
;; user-input select path and for KRAIL spacing
  (if (and (setq sel (entsel "\nSelect a LwPolyline to Insert KRail: "))
	   (setq dist1 "20")
      );; and
;; if the test expressions are true
;; start the insertion process,
;; if not, exits the code...
    (progn
      (setvar "CMDECHO" 0)
;remember current layer and set the current layer to CONE
      (setq cur_lay (getvar "clayer"))
      (setvar "clayer" "KRAIL")
;; sets the variable pickpt with the second list element from the entsel function
      (setq pickpt  (cadr sel)
;; sets the variable path with the first list element from the entsel function
	    path    (car sel)
;; find the polyline length
	    len	    (vlax-curve-getDistAtParam path (vlax-curve-getEndParam path))
;; find the strat point
	    startpt (vlax-curve-getStartPoint path)
;; find the end point
	    endpt   (vlax-curve-getEndPoint path)
      );; setq
;; test if the pick point is closer from the start
      (if (< (distance startpt pickpt) (distance endpt pickpt))
;; if close to start, stores the startpt as inspt and the insertion angle
	(setq inspt startpt
	      ang   (* (/ (angle inspt (vlax-curve-getPointAtDist path 0.001)) pi) 180))
;; if close to end, stores the endpt as inspt and the insertion angle
	(setq inspt endpt
	      ang   (* (/ (angle (vlax-curve-getPointAtDist path (- len 0.001)) inspt) pi 180)))
      );; if  
;insert the KTICK block
      (command "._insert" "KTICK" "_none" inspt "1" "1" "_none" ang)
;create arraypath with KTICK and polyline
      (command "._arraypath" (entlast) "" (osnap pickpt "NEA")  "" "" "" "F" dist1 "" "")
;offset polyline to create krail sides
      (command "._OFFSET" "layer" "Current" "1" (osnap pickpt "NEA") "10000000000000,10000000000000" "e")
      (command "._offset" "layer" "current" "1" (osnap pickpt "NEA") "-10000000000000,-10000000000000" "e")
;revert layer back to original current layer
      (setvar "clayer" cur_lay)
    );; progn
  );; if
  (princ)
);; KRAIL2

 

AutoCAD Customization: .NET: Error downloading autocad suite- standard

$
0
0
Error message saying files are missing

AutoCAD Customization: Visual LISP, AutoLISP and General Customization: Variable in Path to Block in Tool Palette?

$
0
0

I would like to use a variable to set the path to our block library then append the sub-folders and block names to that when inserting block from a tool palette.  It seems like it should be possible since the path to some of ACAD's demo blocks reads: "%SampleFolderLang%\Dynamic Blocks\Annotation - Imperial.dwg"

 

Unfortunately when I try to edit a block's path through right-clicking a block in a tool palette and selecting "Properties..." I am forced into a dialog box and forced to navigate to a folder in addition to typing a path into the text box.  Whatever path exists is appended to the front of what is typed into the box.  I tried to navigate all the way to the root directory but I am given an "invalid" message when I try so select this as the source folder.

 

Is there any other way to edit a blocks path in a tool palette or to otherwise achieve this goal?

 

Thnaks!

AutoCAD Customization: Visual LISP, AutoLISP and General Customization: Connect variables to dimension value

$
0
0
Hello all, I add in AutoCad 2006 two variables , Firstly, constant "$Dim1= 3000" Secondary, function "ddd=$Dim1-100" How I can connect line geometry dimension value to function? Is mean when I change constant automatically update line geometry dimension value. Thanks Stanislav

AutoCAD Customization: Visual LISP, AutoLISP and General Customization: Lisp required to replace part of mtext with out prompt

$
0
0

Please advise a lisp  to replace part of mtext (with 3 lines) with out prompt. MTEXT shown below

 

DATE: 28.05.2012

TEL NO: 04   2541131131

FAX NO : 04  5451212312

 

 

TeL no only want to replace with other pre defined no.

 

Please help 

 

anoop


AutoCAD Customization: .NET: Autocad Mechanical save as command..

$
0
0

There is some method equivalent to Save As AutoCAD Mechanical 2012?

 

The Database object has a Save As method, as an argument that defines a file format, but not sure if it matches the format of AutoCAD Mechanical.

AutoCAD Customization: .NET: how to know the lisp file was loaded in current doc by c#.net

$
0
0

could anyone tell me how to judge whether the lisp file was loaded in current doc by c#.net?

thks

AutoCAD Customization: .NET: How to determine if a point is within a hatch's area

$
0
0

Hi

I'd like to determine when a user selects a point in model space if it is within a hatched area.

 

I started to a look at using the Editor's SelectCrossingWindow but if you zoom in and select a point in between a graphical elements nothing is selected.

 

Please can someone suggest how to do this?

 

Thanks

Craig

AutoCAD Customization: Visual LISP, AutoLISP and General Customization: initget and getpoint

$
0
0
I need help with initget and getpoint If have been using - (initget 128 "U") (setq Point (getpoint (last List_Points) "\nPick NEXT point on line or [U]=Undo ? ")) This works fine if user - picks a point types a 'U' or uses .xyz point filters However, I can't type a distance and use cursor direction to return a point. It returns the distance as text. How can I set initget to allow input of distance?

AutoCAD Customization: Visual LISP, AutoLISP and General Customization: Add to Trusted Locations via lisp

$
0
0

Is it possiable to add to a trusted Location Via a lisp

 

At the moment i have got a shortcut to autocad that runs a script which in turn runs a lisp file to set support paths

 

but would it be possiable instead of support to be a trusted location

 

Basicaly i am going to check if its later than autocad 2013 and then if not add the trusted paths

 

(if (>= (getvar "ACADVER") "19.1")
(do-this))

 

Just need to find the right command to replace the "do-this" with

 

This is what i have got at the moment

 

(if (>= (getvar "ACADVER") "19.1")
(setvar 'trustedpaths

"path1"

"path2"

"path3"

))

 

It it tells me that there are to many arguments

AutoCAD Customization: Visual LISP, AutoLISP and General Customization: Setting dimstyle programatically causes ribbon control to blank

$
0
0

I'm writing a program that creates dimension styles programatically from data stored in a text file.  The first time that I run the program it works fine.  It creates a number of dimension styles and sets one of them current and the current style is reflected correctly in the ribbon:

blank dimstyle0.PNG

 

The second time I run the program the styles that already exist are redefined and one of them is set to the current style. This time the current style is NOT reflected correctly in the ribbon -- the current style appears blank.

blank dimstyle3.PNG

 

Here is some simplified code that reproduces the problem.  The first time that it is run it creates a dimstyle "test style" and sets it current.  The style is correctly show in the ribbon control.  The second time it is run the ribbon control goes blank.

(defun c:dimerr ( / styname famlist suffix)

    (setq styname "test style")
    (setq famList '(
        ("[PARENT]" . "")
        ("[LINEAR FAMILY]" . "$0")
        ("[ANGULAR FAMILY]" . "$2")
        ("[DIAMETER FAMILY]" . "$3")
        ("[RADIUS FAMILY]" . "$4")
        ("[ORDINATE FAMILY]" . "$6")
        ("[LEADER FAMILY]" . "$7")
    ))

    (foreach famMember famList
      (princ (strcat "\n" (car FamMember)))
			
      ;This is where I make some changes to each child style
      ;based on some data...but that seems to have no effect
      ;so I left it out.
			
      (if (setq suffix  (cdr famMember))(progn
         (setq famname (strcat styname suffix))
         (princ (strcat "\nSaving style: " famname ))
         (if (tblsearch "dimstyle" famname)
            (command "dimstyle" "save" famname "y")
            (command "dimstyle" "save" famname)
         )
      ))
    )
    (command "-dimstyle" "restore" styname)
)

Any help would be appreciated.

 

Thanks,

 

James LeVieux

AutoCAD Customization: Visual LISP, AutoLISP and General Customization: vla-put-title to a differnt fielname (Titel)

$
0
0

Hi,

 

I use vla-put-title to change tha value of the title field of a drawing file. But in explorer I can only make the column "Titel" (Dutch) appear. So is there a way to write (put) the value to a different field as the "Title" field? Also I would want to put the value to the title of a folder, which I haven't been able to do yet.

 

Can anyone help me out on this?


AutoCAD Customization: Visual LISP, AutoLISP and General Customization: Open a dwg, get some information and return to the original dwg using script

$
0
0
Hi, I'm trying to open a dwg, get some information and return to the original dwg using script but i'm having trouble doing that. The thing is, everything work perfect fine, but when i try to run the command in the original dwg nothing happens. I thin is because the original dwg is not activated. I have to use the lisp on a new drawing, and i don't see how can I activate an unsaved dwg. Someone could help? Cheers,

AutoCAD Customization: .NET: Load Partial Cui

$
0
0

Hello,

 

I want to load a partial cui.

 

I used this line of code but it doesn´t work in my case;

doc.SendStringToExecute("_.cuiload " & FileCui & " ", False, False, False)

If this code is launched with a command or loaded on startup without scrips it isn´t problem. The menu is loaded correct.

 

 

In my case the application is loaded with a script, "script.scr". This file has some commands to launch when autocad is start;

   netload "D:\MyApplication.dll"
   ribbon
   toolpalettes
   menubar 1

 

In this case the partial menu is not loaded, so i am finding another solutions. 

 

Now i wan´t to load menu with autocad libraries. Like this; 

 

  Private Sub LoadCui(ByVal fileCui As String)
    Dim mainCuiFile As String = ""
    Dim cs As CustomizationSection = Nothing
    Dim csPartial As CustomizationSection = Nothing
    Dim workspaceMenu As WorkspacePopMenu = Nothing

    mainCuiFile = Application.GetSystemVariable("MENUNAME") & ".cuix"
    If System.IO.File.Exists(mainCuiFile) Then
      cs = New CustomizationSection(mainCuiFile)
      If cs IsNot Nothing Then
        cs.PartialCuiFiles.Add(fileCui)

        If (cs.IsModified) Then cs.Save()

      End If
    End If

    cs = Nothing
  End Sub

 

The menu is loaded but it does not displaied. why?

 

Thanks,

 

Ane

 

 

 

AutoCAD Customization: Visual Basic Customization: Reg. Selection Set Error

$
0
0

Hi,

I want to select all circle form the active drawing so I have found the code as mentioned below from "acadauto.chm" which is used for Active VBA reference programming.

' Create the selection set
Dim ssetObj As AcadSelectionSet
ssetObj = objAcadDoc.SelectionSets.Add("SSET")

Dim gpCode(0) As Integer
Dim dataValue(0) As Object
gpCode(0) = 0
dataValue(0) = "Circle"

Dim groupCode As Object, dataCode As Object
groupCode = gpCode
dataCode = dataValue

ssetObj.Select(AcSelect.acSelectionSetAll, , , groupCode, dataCode)

and I am getting the error as mentioned below : 2nd & 3rd arguments were optional so I don't want that
Invalid argument FilterType in Select

Can anyone tell me what is the wrong with this code ?

AutoCAD Customization: Visual LISP, AutoLISP and General Customization: Resetting AutoCAD VB.NET Plug In for the next version of Autocad.

$
0
0

I have both AutoCAD 2012 and 1213 on my machine. When I set up VB.net for AutoCAD
 it only had AutoCAD 2012 on it. Now they installed AutoCAD 2013 on my machine and did not
 remove AutoCAD 2013. Both versions are on a network license. How do I get VB.net 2010
 to work with AutoCAD 2013 and not 2012?

 

 Would I have change the reference paths for AutoCAD 2013 and make sure
 vb.net wizard for 2013 is present? What do I need to change to get VB.net to
 work with AutoCAD 2013?

 

 If I build a *.dll with my VS that is linked to AutoCAD 2012 then use netload
 to load it into AutoCAD 2013 the program will not load it. If I go back to AutoCAD
 2012 and use netload 2012 will load it.

 

 If I plan to use VB.net with AutoCAD I will need to know how to use net programs
 with various versions of CAD in the future and I will need to know how to move
 and store my programs on portable drives. So how do I deal with the VB.net AutoCAD
 file mapping/reference problem?

 

 AutoCAD VBA I did not have this problem because my code was in one file.
 With VB.net it is one problem after another.

 

 Thank you,

AutoCAD Customization: Visual LISP, AutoLISP and General Customization: Label AEC_2D_SECTION without exploding

$
0
0

Using 2014 MEP

Cutting sections and need some code to grab the layer info

from objects within the section without exploding it

so i can update it at a later date..

 

section cuts keep layers of object, yet the data is in the DB someplace

more code then i know and cant find anything close

 

looking to be able to pick a line within a section cut

have it grab the layer name and place text with the layer above the object

 

all without exploding the 2D section cut

Viewing all 1680 articles
Browse latest View live


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