Insert block with attributes using DCL

Insert block with attributes using DCL

amrivasU38U2
Contributor Contributor
5,238 Views
32 Replies
Message 1 of 33

Insert block with attributes using DCL

amrivasU38U2
Contributor
Contributor

Can anyone help me create a lisp code based on this dcl. I want to insert a block with attributes. Expected results are in Cable Test.dwg. A big thanks to anyone.

 
 
 
 
 
 
 
 
 
 
0 Likes
Accepted solutions (2)
5,239 Views
32 Replies
Replies (32)
Message 21 of 33

amrivasU38U2
Contributor
Contributor

I tested the code but when the popup shows to choose manufacturer. Clicking radio button of Extron for example, the radio button of the Liberty or the previous selected manufacturer did not turn-off. Also, the output should insert a block _AVSF-PRT CBL-LBL instead of displaying it.

 
 
 
 
0 Likes
Message 22 of 33

amrivasU38U2
Contributor
Contributor
What I mean is, is it possible to EXTRON and LIBERTY to use same coding as this one
((eq *hdmi-manu* "C2G")
(cond
((eq *hdmi-model* "3FT")
(setpropertyvalue (entlast) att-model "56782")
)
((eq *hdmi-model* "6FT")
(setpropertyvalue (entlast) att-model "56783")
)
((eq *hdmi-model* "10FT")
(setpropertyvalue (entlast) att-model "56784")
)
((eq *hdmi-model* "12FT")
(setpropertyvalue (entlast) att-model "50611")
)
((eq *hdmi-model* "15FT")
(setpropertyvalue (entlast) att-model "50612")
)
)
)

I find it more easier to tweak and add another manufacturer and cable length.
0 Likes
Message 23 of 33

paullimapa
Mentor
Mentor

Sure...but there's really no need to tweak that portion of the LIBERTY & EXTRON code since their model # have a pattern that can be easily applied when the length changes. In fact you can even add to the cable lengths for those two manufacturers and the condition statements as the code is written now can already determine the model #.

As for future Manufacturer additions, that should not impact how the condition statements are written for LIBERTY & EXTRON. You can very easily copy the condition statements used by the C2G to apply for their model #s.


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 24 of 33

amrivasU38U2
Contributor
Contributor

Thank you so much. One last request please. Could you please check this lisp code why i can't load it in autocad. There is an error encountered "malformed list on input" . I just replace cond for liberty and extron and tested if it works also since i will  replicate this code to create a separate lisp for USB connector which have different model number and can't satisfy the condition of liberty and extron. 

 
 
 
 
 
 
0 Likes
Message 25 of 33

paullimapa
Mentor
Mentor
Accepted solution

Some how you left out the highlighted 2 lines at the end:

paullimapa_0-1730299296080.png

 

 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 26 of 33

amrivasU38U2
Contributor
Contributor

Thank you so much for this. Works perfectly. 

 
 
0 Likes
Message 27 of 33

paullimapa
Mentor
Mentor

glad to have helped...cheers!!!


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 28 of 33

traci_haberghamJQEJT
Enthusiast
Enthusiast

Hi there,  using this method of data input how would I save the input/button values as a variable?  So I would like to save the say the chosen company as one and then the value as another?  sorry its most probably simple but I can't get it to work for me.  Any help appreciated.  Thank you 🙂

0 Likes
Message 29 of 33

paullimapa
Mentor
Mentor

Please elaborate further because you’ve been referring to creating dialog gui to select data input for EXTRON, LIBERTY and C2G.  Are you saying when each of these dialog appears in the current dwg session the previous values selected are not shown selected again?  Zip all three lisp and dcl codes and attach here for review 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 30 of 33

traci_haberghamJQEJT
Enthusiast
Enthusiast

Hi Paul, I don't have the code, it was just in reference to the above (I would just change the values to suit what I want as the code looks great) but I was wondering how the values that are selected can be saved as variables for use within Autolisp.  Hope that makes sense.  Thanks

 

0 Likes
Message 31 of 33

paullimapa
Mentor
Mentor

For example the code currently is written with the following variable that can still be retrieved after the dialog completes:

*hdmi-manu*

At the command prompt you can enter the following to check:

!*hdmi-manu*

Thats an exclamation mark at the beginning

Autocad should return the current value that’s set to that variable 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 32 of 33

scot-65
Advisor
Advisor

Watching this thread one item comes to mind regarding expandability without having to re-code the LSP program.

I'm sure some sort of XLS file can be opened to read but since I am more old fashioned I would suggest an INI file (named CFG).

 

[Manufacturer Name #1]

model=

lengths=3,4,6,8

etc.

 

Parse this and populate 2 list boxes in the dialog.

When Name is selected from the first list box, action_tile and repopulate the other list box with the available lengths.

The index return of the second list box can be used to target the model number.

 

Edit the INI file and not the LSP file.

 


Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.

0 Likes
Message 33 of 33

Sea-Haven
Mentor
Mentor

If your talking about my two column dcl then look at post 7 for example code. Yes you can save the result and set the matching radio button so can just do ok when ran again. Get code working 1st then will explain how.

0 Likes