AutoCAD Plant 3D General DIscussion

AutoCAD Plant 3D General DIscussion

Reply
Valued Contributor
86 Posts
4 Kudos
Registered: ‎10-18-2007
Post 1 of 4

When object has been insterted,next time script works incorrectly

392 Views, 3 Replies
06-21-2013 08:56 AM

Please, help me!

There's a simple script:

import sys
import os
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'CustomScripts'))



from aqa.math import *
from varmain.primitiv import *
from varmain.custom import *


@activate(Group="Support", TooltipShort="Test script", TooltipLong="This is a custom Testscript", LengthUnit="in")
@group("MainDimensions")
@param(aL=LENGTH, TooltipLong="Length of the Cylinder")


def TEST1(s, aL=75.0, ID='P_ACTUATOR_008', **kw):

       aL=float(raw_input("Input text"))
       print "You have been enter:"
       print (aL)

 Look here:

  1. Plant 3D Russian 2013 (Ultimate Suite) SP1, Windows 7 Ultimate
  2. I compile my script using PLANTREGISTERCUSTOMSCRIPT command and restart Plant 3D after this
  3. (arxload "PnP3dACPAdapter.arx")
  4. (TESTACPSCRIPT "TEST1")

Please see my command line log :

Команда: (arxload "PnP3dACPAdapter.arx")
"PnP3dACPAdapter.arx"

Команда: (TESTACPSCRIPT "TEST1")
Input text78
You have been enter:
78.0
<Имя объекта: 7ffff705c00>

Команда: (TESTACPSCRIPT "TEST1")
<Имя объекта: 7ffff705c20>

 

As you can see, my friends, when script was executed in the next time in the same session, it keeps aL value.

 

When we now execute _PURGE command, script will be executed correctly.

 

How to modify my script???

Valued Contributor
86 Posts
4 Kudos
Registered: ‎10-18-2007
Post 2 of 4

Re: When object has been insterted,next time script works incorrectly

06-27-2013 05:20 AM in reply to: kudryavcevrm

up

ADN Support Specialist
37 Posts
3 Kudos
Registered: ‎05-25-2011
Post 3 of 4

Re: When object has been insterted,next time script works incorrectly

07-02-2013 01:36 AM in reply to: kudryavcevrm

The scripts are meant to create geometry (i.e. a block). To avoid regenerating the same block all the time, Plant 3D first looks up the block table if it already has a block that matches the script parameters. If such a block exists, it will just use it, and not invoke the script.

 

It looks like in this case, each block shall be unique. I haven’t tried it, but (TESTACPSCRIPT "…" "__unique__" "1") will probably do what is wanted. It will create an anonymous block instead of a block that hashes the parameters.



Marat Mirgaleev
Developer Technical Services
Autodesk Developer Network
Valued Contributor
86 Posts
4 Kudos
Registered: ‎10-18-2007
Post 4 of 4

Re: When object has been insterted,next time script works incorrectly

07-29-2013 06:00 AM in reply to: Marat.Mirgaleev
Thank you, Marat.
"__unique__" works fine in test mode. But we need to use script in real life, not in test mode only. We need to compile script as unique.
Help me, please!
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Need installation help?

Start with some of our most frequented solutions to get help installing your software.

New AutoCAD Plant 3D Category!

The AutoCAD Plant 3D forum has moved into it's very own category page, and can no longer be found within the Additional Product Forums.

Announcements
Are you interested in helping shape the future of the Autodesk Community? To participate in this brief usability study, please click here. Your time and input is greatly appreciated!